fix pre-commit
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 1m42s
CI/CD Pipeline / Run Tests (pull_request) Successful in 2m25s
CI/CD Pipeline / Telegram Notify Success (pull_request) Successful in 1m34s
Some checks failed
CI/CD Pipeline / Telegram Notify Success (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (pull_request) Successful in 1m42s
CI/CD Pipeline / Run Tests (pull_request) Successful in 2m25s
CI/CD Pipeline / Telegram Notify Success (pull_request) Successful in 1m34s
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from apps.core.models import BackgroundJob, JobStatus
|
||||
from apps.parsers.models import FinancialReport, FinancialReportLine, ParserLoadLog
|
||||
from django.test import override_settings
|
||||
@@ -161,21 +164,21 @@ class SourceCardsApiTestCase(APITestCase):
|
||||
self.assertIn("status_label", row)
|
||||
self.assertIn("active_tasks", row)
|
||||
|
||||
@override_settings(
|
||||
FNS_WATCH_DIRECTORY="/tmp/mostovik-test-fns/watch",
|
||||
FNS_PROCESSED_DIRECTORY="/tmp/mostovik-test-fns/processed",
|
||||
FNS_FAILED_DIRECTORY="/tmp/mostovik-test-fns/failed",
|
||||
)
|
||||
def test_refresh_creates_background_job_and_returns_task(self):
|
||||
self.client.force_authenticate(self.admin)
|
||||
response = self.client.post(
|
||||
reverse(
|
||||
"api_v1:sources:source-cards-refresh",
|
||||
kwargs={"slug": "financial-indicators"},
|
||||
),
|
||||
{},
|
||||
format="json",
|
||||
)
|
||||
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",
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
|
||||
self.assertTrue(response.data["success"])
|
||||
|
||||
Reference in New Issue
Block a user