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