feat: expand registry ingestion and demo exchange
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from apps.core.models import BackgroundJob, JobStatus
|
||||
from apps.parsers.models import ParserLoadLog
|
||||
@@ -236,21 +234,17 @@ class SourceCardsApiTestCase(APITestCase):
|
||||
self.assertIn("status_label", row)
|
||||
self.assertIn("active_tasks", row)
|
||||
|
||||
@override_settings(CELERY_TASK_ALWAYS_EAGER=False)
|
||||
def test_refresh_creates_background_job_and_returns_task(self):
|
||||
self.client.force_authenticate(self.admin)
|
||||
with TemporaryDirectory() as tmp_dir, override_settings(
|
||||
FNS_WATCH_DIRECTORY=str(Path(tmp_dir) / "watch"),
|
||||
FNS_PROCESSED_DIRECTORY=str(Path(tmp_dir) / "processed"),
|
||||
FNS_FAILED_DIRECTORY=str(Path(tmp_dir) / "failed"),
|
||||
):
|
||||
response = self.client.post(
|
||||
reverse(
|
||||
"api_v1:sources:source-cards-refresh",
|
||||
kwargs={"slug": "financial-indicators"},
|
||||
),
|
||||
{},
|
||||
format="json",
|
||||
)
|
||||
response = self.client.post(
|
||||
reverse(
|
||||
"api_v1:sources:source-cards-refresh",
|
||||
kwargs={"slug": "financial-indicators"},
|
||||
),
|
||||
{},
|
||||
format="json",
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
|
||||
self.assertEqual(response.data["status"], "accepted")
|
||||
@@ -260,7 +254,7 @@ class SourceCardsApiTestCase(APITestCase):
|
||||
self.assertTrue(
|
||||
BackgroundJob.objects.filter(
|
||||
task_id=task_id,
|
||||
task_name="apps.parsers.tasks.scan_fns_directory",
|
||||
task_name="apps.parsers.tasks.sync_fns_financial_reports",
|
||||
user_id=self.admin.id,
|
||||
).exists()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user