Exclude cancelled reservations before ARR field review
This commit is contained in:
1 parent
36235e7d8d
commit
0c057a8e75
39 files changed
+1546
-56
No files matched your search
@@ -193,6 +193,41 @@ class PostgresDownloadIntegrationTests(unittest.TestCase):
|
||||
self.assertEqual(json.loads(response.body)["data"]["job_id"], task["job_id"])
|
||||
self.assertEqual((self.reader_calls, self.adapter.calls, self.validator.calls, self.processor.calls), (1, 1, 1, 1))
|
||||
|
||||
def source_with_cancelled_first(self, **kwargs):
|
||||
cancelled = FixtureExecutor.xml(room="SYNTHETIC-CANCELLED").replace(
|
||||
b"<DISP_ROOM_NO>SYNTHETIC-CANCELLED</DISP_ROOM_NO>", b"<DISP_ROOM_NO/>"
|
||||
).replace(b"</G_RESERVATION>", b"<RESV_STATUS>CANCELLED</RESV_STATUS></G_RESERVATION>")
|
||||
start = cancelled.index(b"<G_RESERVATION>")
|
||||
end = cancelled.index(b"</G_RESERVATION>") + len(b"</G_RESERVATION>")
|
||||
return FixtureExecutor.xml(**kwargs).replace(
|
||||
b"<LIST_G_RESERVATION>", b"<LIST_G_RESERVATION>" + cancelled[start:end]
|
||||
)
|
||||
|
||||
def test_cancelled_without_room_is_audited_but_daily_monthly_use_retained_only(self):
|
||||
self.adapter.payload = self.source_with_cancelled_first()
|
||||
self.execute()
|
||||
self.assert_one_commit()
|
||||
self.assertEqual(self.sql("SELECT source_rows,retained_rows,excluded_cancelled_rows FROM finance.daily_versions"), [(2, 1, 1)])
|
||||
self.assertEqual(self.sql("SELECT outcome,disp_room_no FROM finance.daily_records ORDER BY source_sequence"),
|
||||
[("excluded_cancelled", ""), ("retained", "SYNTHETIC-ROOM-1")])
|
||||
self.assertEqual(self.count("finance.v_active_daily_facts"), 1)
|
||||
self.assertEqual(self.monthly_worker().process_next().status, "published")
|
||||
self.assertEqual(self.count("reporting.monthly_runs"), 1)
|
||||
self.execute()
|
||||
self.assert_one_commit()
|
||||
self.assertEqual(self.sql("SELECT excluded_cancelled_rows FROM finance.daily_versions"), [(1,)])
|
||||
|
||||
def test_failed_batch_retains_cancelled_audit_count_without_monthly_commit(self):
|
||||
self.adapter.payload = self.source_with_cancelled_first(departure="2026-09-14")
|
||||
self.execute()
|
||||
self.assertEqual(self.sql("SELECT version_status,source_rows,excluded_cancelled_rows,validation_failed_rows FROM finance.daily_versions"),
|
||||
[("rejected", 2, 1, 1)])
|
||||
self.assertEqual(self.sql("SELECT outcome FROM finance.daily_records ORDER BY source_sequence"),
|
||||
[("excluded_cancelled",), ("validation_failed",)])
|
||||
self.assertEqual(self.daily_event_count(), 0)
|
||||
self.assertEqual(self.count("finance.current_daily_versions"), 0)
|
||||
self.assertEqual(self.monthly_worker().process_next().status, "idle")
|
||||
|
||||
def test_rejected_commit_lost_ack_recovers_same_failure_without_new_capture(self):
|
||||
self.adapter.payload = FixtureExecutor.xml(rate_code="")
|
||||
state = {"armed": True}
|
||||
|
||||
Reference in new issue
Block a user