Files
mostovik-backend/tests/apps/parsers/test_dashboard_page.py
Aleksandr Meshchriakov be7af18c36
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 21s
CI/CD Pipeline / Build and Push Images (push) Successful in 6s
CI/CD Pipeline / Internal Notify (push) Successful in 1s
CI/CD Pipeline / Deploy Dev in Dokploy (push) Successful in 1s
feat(dashboard): improve parser API checks
2026-04-29 11:47:45 +02:00

79 lines
3.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Regression tests for the standalone parser dashboard page."""
from django.test import TestCase
class ParserDashboardPageTest(TestCase):
def test_dashboard_exposes_login_and_registration_flows(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn('id="loginForm"', content)
self.assertIn('id="registerForm"', content)
self.assertIn("/api/v1/users/login/", content)
self.assertIn("/api/v1/users/register/", content)
def test_dashboard_does_not_drop_jwt_on_registers_panel_failure(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("refreshRegisters().catch(renderRegistersUnavailable)", content)
self.assertIn("isAuthError(error)", content)
def test_dashboard_has_group_fallback_for_current_api_shape(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("function sourceGroups()", content)
self.assertIn("dashboardData?.file_sources", content)
def test_dashboard_uses_vue_component_table_for_source_results(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("https://cdn.jsdelivr.net/npm/vue@3/", content)
self.assertIn("https://cdn.jsdelivr.net/npm/element-plus@2/", content)
self.assertIn('id="sourceRecordsApp"', content)
self.assertIn("<el-table", content)
self.assertIn("Обновляю данные без сброса таблицы", content)
def test_dashboard_does_not_send_limit_to_paginated_source_result_api(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("if (!source.result_list_url) {", content)
self.assertIn("query.limit = this.pageSize", content)
def test_dashboard_humanizes_schedules_and_registry_completeness(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("function humanizeSchedule", content)
self.assertIn("registryCompletenessChart", content)
self.assertIn("chart-grid-full", content)
self.assertIn("function registryDisplayName", content)
self.assertIn('data-main-tab="endpoints"', content)
self.assertIn("function buildEndpointCatalog", content)
self.assertIn("checkAllEndpointsButton", content)
self.assertIn("endpointCheckModal", content)
self.assertIn("data-toggle", content)
self.assertIn("iconButton", content)
def test_dashboard_endpoint_checker_uses_row_details_modal(self):
response = self.client.get("/dashboard")
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn("latestEndpointResultMap", content)
self.assertIn("endpointCheckSummary", content)
self.assertIn("data-endpoint-run", content)
self.assertIn("data-endpoint-detail", content)
self.assertIn("showEndpointDetail", content)
self.assertIn("без данных", content)