feat: align source data and nightly exports
This commit is contained in:
@@ -170,6 +170,59 @@ class OrganizationSourceExtensionsApiV2Test(APITestCase):
|
||||
self.assertEqual(record["source_group"], "planned_inspections")
|
||||
self.assertEqual(record["organization"]["uid"], str(target.uid))
|
||||
|
||||
def test_flat_arbitration_records_expose_frontend_role_labels(self):
|
||||
organization = create_frontend_organization(
|
||||
name='ООО "Arbitration Roles"',
|
||||
inn="7707083899",
|
||||
ogrn="1027700132099",
|
||||
)
|
||||
extension = ArbitrationExtension.objects.create(
|
||||
organization=organization,
|
||||
title="Арбитраж",
|
||||
)
|
||||
expected_roles = {
|
||||
"ROLE-PLAINTIFF": "Истец",
|
||||
"ROLE-DEFENDANT": "Ответчик",
|
||||
"ROLE-THIRD-PARTY": "Третье лицо",
|
||||
}
|
||||
for external_id, provider_role in (
|
||||
("ROLE-PLAINTIFF", "plaintiff"),
|
||||
("ROLE-DEFENDANT", "defendant"),
|
||||
("ROLE-THIRD-PARTY", "third_party"),
|
||||
):
|
||||
OrganizationSourceRecord.objects.create(
|
||||
extension=extension,
|
||||
record_type="arbitration_case",
|
||||
source="arbitration",
|
||||
external_id=external_id,
|
||||
payload={"target": {"role": provider_role}},
|
||||
)
|
||||
|
||||
response = self.client.get(
|
||||
reverse("api_v2:organizations:organization-source-records-list"),
|
||||
{
|
||||
"source_group": "arbitration",
|
||||
"source": "arbitration",
|
||||
"organization": str(organization.uid),
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
records_by_external_id = {
|
||||
item["external_id"]: item for item in response.data["data"]
|
||||
}
|
||||
self.assertEqual(
|
||||
{
|
||||
external_id: records_by_external_id[external_id]["payload"]["role"]
|
||||
for external_id in expected_roles
|
||||
},
|
||||
expected_roles,
|
||||
)
|
||||
self.assertNotIn(
|
||||
"role",
|
||||
OrganizationSourceRecord.objects.get(external_id="ROLE-PLAINTIFF").payload,
|
||||
)
|
||||
|
||||
def test_flat_source_records_filters_supported_groups_by_canonical_date(self):
|
||||
organization = create_frontend_organization(
|
||||
name='ООО "Canonical dates"',
|
||||
|
||||
Reference in New Issue
Block a user