From 3b9b558628488b2d5012981cf711643d1d527dc9 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 7 Jul 2026 11:50:10 +0000 Subject: [PATCH] =?UTF-8?q?The=20job=20number=20is=20stored=20in=20the=20c?= =?UTF-8?q?lient=5Fbooking=5Freference=20column=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 | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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 89d4cde38..aaa96733b 100644 --- a/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py +++ b/tests/repositories/hubspot_deals/test_deal_database_postgres_gateway.py @@ -2,7 +2,7 @@ from collections.abc import Iterator import pytest from sqlalchemy import Engine -from sqlmodel import Session +from sqlmodel import Session, text from backend.app.db.models.hubspot_deal_data import HubspotDealData from repositories.hubspot_deals.deal_database_postgres_gateway import ( @@ -48,6 +48,30 @@ def test_record_job_no_for_an_unknown_deal_raises(session: Session) -> None: gateway.record_job_no(deal_id="0000000000", job_no="AD0226519") +def test_the_job_no_is_stored_in_the_client_booking_reference_column( + session: Session, +) -> None: + # The physical column matches the HubSpot property the job number is + # stored under (client_booking_reference); only the domain calls it + # job_no. The deployed table is migrated by the frontend repo, so the + # column name here must match what that migration created. + # Arrange + _insert_deal(session, DEAL_ID) + gateway = DealDatabasePostgresGateway(session=session) + + # Act + gateway.record_job_no(deal_id=DEAL_ID, job_no="AD0226519") + + # Assert + stored = session.exec( # type: ignore[reportCallOverload] + text( + "select client_booking_reference from hubspot_deal_data " + "where deal_id = :deal_id" + ).bindparams(deal_id=DEAL_ID) + ).one() + assert stored[0] == "AD0226519" + + def test_job_no_for_deal_returns_the_recorded_job_no(session: Session) -> None: # Arrange _insert_deal(session, DEAL_ID)