Refactor code for consistency and readability
Some checks failed
CI / ci (push) Failing after 14s

- 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:
2026-02-07 18:01:49 +03:00
parent 02b38a25eb
commit 2a0e0c216a
19 changed files with 322 additions and 209 deletions

View File

@@ -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