"""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("", content) self.assertIn("На начало", content) self.assertIn("Покрытие доп. данными", content) def test_dashboard_uses_v2_registry_upload_routes(self): response = self.client.get("/dashboard") self.assertEqual(response.status_code, 200) content = response.content.decode() self.assertIn("REGISTRY_UPLOAD_SLUGS_BY_NAME", content) self.assertIn("/api/v2/registers/${registrySlug}/upload/", content) self.assertIn("/api/v2/registers/opk/upload/", content) self.assertIn("registryUploadUrlForSelectedRegistry", content) def test_dashboard_exposes_v2_source_csv_downloads(self): response = self.client.get("/dashboard") self.assertEqual(response.status_code, 200) content = response.content.decode() self.assertIn("function sourceCsvDownloadUrl", content) self.assertIn("/api/v2/sources/${source.api_route}/download/", content) self.assertIn("data-source-download", content) self.assertIn("downloadSourceCsv", content) self.assertIn("CSV", content) self.assertNotIn("/api/v2/sources/fns/reports/download/", content)