fix(parsers): retry quarantined ROPK snapshots
This commit is contained in:
@@ -302,6 +302,7 @@ def import_ropk_sanctions( # noqa: C901
|
||||
source=ROPK_SANCTIONS_SOURCE,
|
||||
sha256=sha256,
|
||||
status=ParserSourceArtifact.Status.PUBLISHED,
|
||||
quarantined_count=0,
|
||||
)
|
||||
.exclude(uid=artifact.uid)
|
||||
.order_by("-created_at")
|
||||
|
||||
@@ -268,6 +268,46 @@ class RopkSanctionsImportTest(TestCase):
|
||||
1,
|
||||
)
|
||||
|
||||
def test_duplicate_checksum_with_quarantine_is_reprocessed(self):
|
||||
raw = _workbook(
|
||||
[
|
||||
_row(
|
||||
"retry",
|
||||
ogrn="1027700132101",
|
||||
inn="7707083801",
|
||||
okpo="12345671",
|
||||
)
|
||||
]
|
||||
).getvalue()
|
||||
first_artifact, first = import_ropk_sanctions(
|
||||
handle=BytesIO(raw),
|
||||
original_name="first.xlsx",
|
||||
load_batch=24,
|
||||
uploaded_by_id=None,
|
||||
)
|
||||
Organization.objects.create(
|
||||
name="АО Добавлено после карантина",
|
||||
inn="7707083801",
|
||||
ogrn="1027700132101",
|
||||
okpo="12345671",
|
||||
opk_registry_membership=True,
|
||||
directory_imported_at=timezone.now(),
|
||||
)
|
||||
|
||||
second_artifact, second = import_ropk_sanctions(
|
||||
handle=BytesIO(raw),
|
||||
original_name="second.xlsx",
|
||||
load_batch=25,
|
||||
uploaded_by_id=None,
|
||||
)
|
||||
|
||||
self.assertEqual(first.quarantined, 1)
|
||||
self.assertEqual(first_artifact.quarantined_count, 1)
|
||||
self.assertFalse(second.skipped)
|
||||
self.assertEqual(second.published, 1)
|
||||
self.assertEqual(second.quarantined, 0)
|
||||
self.assertEqual(second_artifact.status, ParserSourceArtifact.Status.PUBLISHED)
|
||||
|
||||
def test_invalid_header_order_rejects_batch_and_preserves_snapshot(self):
|
||||
import_ropk_sanctions(
|
||||
handle=_workbook([_row("old")]),
|
||||
|
||||
Reference in New Issue
Block a user