From 2b29a2412b05c58441802e37afac2efb0e8645e6 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 7 Jul 2026 09:54:56 +0000 Subject: [PATCH] =?UTF-8?q?The=20deal=20database=20gateway=20reads=20back?= =?UTF-8?q?=20a=20deal's=20recorded=20job=5Fno=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../test_deal_database_postgres_gateway.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py b/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py index 9e6e0c9a2..89d4cde38 100644 --- a/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py +++ b/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py @@ -46,3 +46,41 @@ def test_record_job_no_for_an_unknown_deal_raises(session: Session) -> None: # Act / Assert with pytest.raises(ValueError): gateway.record_job_no(deal_id="0000000000", job_no="AD0226519") + + +def test_job_no_for_deal_returns_the_recorded_job_no(session: Session) -> None: + # Arrange + _insert_deal(session, DEAL_ID) + gateway = DealDatabasePostgresGateway(session=session) + gateway.record_job_no(deal_id=DEAL_ID, job_no="AD0226519") + + # Act + job_no = gateway.job_no_for_deal(DEAL_ID) + + # Assert + assert job_no == "AD0226519" + + +def test_job_no_for_deal_returns_none_before_any_job_is_recorded( + session: Session, +) -> None: + # Arrange + _insert_deal(session, DEAL_ID) + gateway = DealDatabasePostgresGateway(session=session) + + # Act + job_no = gateway.job_no_for_deal(DEAL_ID) + + # Assert + assert job_no is None + + +def test_job_no_for_deal_returns_none_for_an_unknown_deal(session: Session) -> None: + # Arrange + gateway = DealDatabasePostgresGateway(session=session) + + # Act + job_no = gateway.job_no_for_deal("0000000000") + + # Assert + assert job_no is None