feat(registries): add SME and budget imports and fix source API workflows
All checks were successful
Mostovik Backend CI/CD / Tests and lint (push) Successful in 9m37s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Successful in 4m18s
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Successful in 1m48s
All checks were successful
Mostovik Backend CI/CD / Tests and lint (push) Successful in 9m37s
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Successful in 4m18s
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been skipped
Mostovik Backend CI/CD / Deploy customer main (push) Has been skipped
Mostovik Backend CI/CD / Deploy dev (push) Successful in 1m48s
This commit is contained in:
@@ -15,7 +15,7 @@ from apps.parsers.source_cards import (
|
||||
)
|
||||
from django.db import connection
|
||||
from django.http import Http404
|
||||
from django.test import SimpleTestCase, TestCase, override_settings
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test.utils import CaptureQueriesContext
|
||||
from django.utils import timezone
|
||||
from organizations.models import Organization
|
||||
@@ -75,7 +75,7 @@ def _save_source_record(
|
||||
)
|
||||
|
||||
|
||||
class SourceCardServiceUnitTest(SimpleTestCase):
|
||||
class SourceCardServiceUnitTest(TestCase):
|
||||
def test_list_cards_exposes_all_frontend_category_slugs_in_menu_order(self):
|
||||
self.assertEqual(
|
||||
[card.slug for card in SOURCE_CARD_DEFINITIONS],
|
||||
@@ -92,6 +92,8 @@ class SourceCardServiceUnitTest(SimpleTestCase):
|
||||
"labor-vacancies",
|
||||
"gosedo-global-address-directory",
|
||||
"media-mentions",
|
||||
"sme-support-recipients-registry",
|
||||
"budget-process-registry",
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
@@ -109,6 +111,8 @@ class SourceCardServiceUnitTest(SimpleTestCase):
|
||||
"Вакансии Работа России",
|
||||
"ГосЭДО: Глобальный адресный справочник",
|
||||
"Новости СМИ",
|
||||
"Реестр субъектов МСП — получателей поддержки",
|
||||
"Реестр участников бюджетного процесса",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -331,16 +335,11 @@ class SourceCardServiceUnitTest(SimpleTestCase):
|
||||
"Обновление для карточки не поддерживается", str(error.exception.detail)
|
||||
)
|
||||
|
||||
def test_enqueue_task_deletes_background_job_on_async_error(self):
|
||||
def test_enqueue_task_preserves_failure_for_polling_on_async_error(self):
|
||||
task = MagicMock()
|
||||
task.apply_async.side_effect = RuntimeError("broker down")
|
||||
queryset = MagicMock()
|
||||
|
||||
with patch(
|
||||
"apps.parsers.source_cards.uuid.uuid4", return_value="task-id-1"
|
||||
), patch("apps.parsers.source_cards.BackgroundJobService.create_job"), patch(
|
||||
"apps.parsers.source_cards.BackgroundJobService.get_queryset",
|
||||
return_value=queryset,
|
||||
), self.assertRaisesMessage(RuntimeError, "broker down"):
|
||||
SourceCardService._enqueue_task(
|
||||
task=task,
|
||||
@@ -350,8 +349,9 @@ class SourceCardServiceUnitTest(SimpleTestCase):
|
||||
kwargs={"region_code": "77"},
|
||||
)
|
||||
|
||||
queryset.filter.assert_called_once_with(task_id="task-id-1")
|
||||
queryset.filter.return_value.delete.assert_called_once_with()
|
||||
job = BackgroundJob.objects.get(task_id="task-id-1")
|
||||
self.assertEqual(job.status, JobStatus.FAILURE)
|
||||
self.assertTrue(job.error)
|
||||
|
||||
def test_helper_methods_cover_unknown_codes_and_status_variants(self):
|
||||
self.assertEqual(SourceCardService._get_source_records_count("unknown"), 0)
|
||||
|
||||
Reference in New Issue
Block a user