- Standardized string quotes across multiple files to use double quotes for consistency. - Improved formatting of JSON dumps in mock data for better readability. - Enhanced the structure of various functions and data definitions for clarity. - Updated test cases to reflect changes in data structure and ensure accuracy.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Tests for dashboard.prometheus_utils.query."""
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
@@ -12,13 +13,7 @@ class QueryPrometheusTest(TestCase):
|
||||
@patch("dashboard.prometheus_utils.query.requests.get")
|
||||
def test_single_result_returns_value_string(self, mock_get):
|
||||
mock_response = MagicMock()
|
||||
mock_response.json.return_value = {
|
||||
"data": {
|
||||
"result": [
|
||||
{"value": ["1234567890", "42"]}
|
||||
]
|
||||
}
|
||||
}
|
||||
mock_response.json.return_value = {"data": {"result": [{"value": ["1234567890", "42"]}]}}
|
||||
mock_response.raise_for_status = MagicMock()
|
||||
mock_get.return_value = mock_response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user