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:
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
from apps.core.models import BackgroundJob, JobStatus
|
||||
@@ -182,25 +181,7 @@ class SourcesApiE2ETest(APITestCase):
|
||||
def test_refresh_endpoints_cover_multiple_source_cards(self):
|
||||
self.client.force_authenticate(self.admin)
|
||||
|
||||
with patch(
|
||||
"apps.parsers.source_cards.uuid.uuid4",
|
||||
side_effect=[
|
||||
"request-minprom",
|
||||
"task-industrial",
|
||||
"task-products",
|
||||
"task-manufactures",
|
||||
"request-procurements",
|
||||
"task-procurements",
|
||||
],
|
||||
), patch(
|
||||
"celery.app.task.Task.apply_async",
|
||||
side_effect=[
|
||||
SimpleNamespace(id="task-industrial"),
|
||||
SimpleNamespace(id="task-products"),
|
||||
SimpleNamespace(id="task-manufactures"),
|
||||
SimpleNamespace(id="task-procurements"),
|
||||
],
|
||||
):
|
||||
with patch("celery.app.task.Task.apply_async") as dispatch:
|
||||
minprom_response = self.client.post(
|
||||
reverse(
|
||||
"api_v1:sources:source-cards-refresh",
|
||||
@@ -229,30 +210,34 @@ class SourcesApiE2ETest(APITestCase):
|
||||
set(minprom_response.data.keys()),
|
||||
{"task_id", "task_ids", "status"},
|
||||
)
|
||||
self.assertEqual(minprom_response.data["task_id"], "task-industrial")
|
||||
first_task_ids = [
|
||||
call.kwargs["task_id"] for call in dispatch.call_args_list[:3]
|
||||
]
|
||||
procurement_task_id = dispatch.call_args_list[3].kwargs["task_id"]
|
||||
self.assertEqual(minprom_response.data["task_id"], first_task_ids[0])
|
||||
self.assertEqual(
|
||||
minprom_response.data["task_ids"],
|
||||
["task-industrial", "task-products", "task-manufactures"],
|
||||
first_task_ids,
|
||||
)
|
||||
self.assertEqual(
|
||||
set(procurements_response.data.keys()),
|
||||
{"task_id", "task_ids", "status"},
|
||||
)
|
||||
self.assertEqual(procurements_response.data["task_id"], "task-procurements")
|
||||
self.assertEqual(procurements_response.data["task_id"], procurement_task_id)
|
||||
self.assertEqual(
|
||||
procurements_response.data["task_ids"],
|
||||
["task-procurements"],
|
||||
[procurement_task_id],
|
||||
)
|
||||
self.assertEqual(
|
||||
BackgroundJob.objects.filter(
|
||||
task_id__in=["task-industrial", "task-products", "task-manufactures"],
|
||||
task_id__in=first_task_ids,
|
||||
user_id=self.admin.id,
|
||||
).count(),
|
||||
3,
|
||||
)
|
||||
self.assertTrue(
|
||||
BackgroundJob.objects.filter(
|
||||
task_id="task-procurements",
|
||||
task_id=procurement_task_id,
|
||||
task_name="apps.parsers.tasks.parse_registry_enrichment_sources",
|
||||
user_id=self.admin.id,
|
||||
).exists()
|
||||
|
||||
Reference in New Issue
Block a user