Skip to content

Commit

Permalink
fix: Fix spanner postgres test related to timezone issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
anubhav756 committed Nov 18, 2024
1 parent 429a446 commit 1c4f4b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions retrieval_service/datastore/providers/spanner_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,6 @@ async def validate_ticket(
departure_airport: str,
departure_time: str,
) -> tuple[Optional[models.Flight], Optional[str]]:
departure_time_datetime = datetime.datetime.strptime(
departure_time, "%Y-%m-%d %H:%M:%S"
)
with self.__database.snapshot() as snapshot:
# Spread SQL query for readability
results = snapshot.execute_sql(
Expand All @@ -845,7 +842,7 @@ async def validate_ticket(
"p1": airline,
"p2": flight_number,
"p3": departure_airport,
"p4": departure_time_datetime,
"p4": departure_time,
},
param_types={
"p1": param_types.STRING,
Expand All @@ -865,6 +862,8 @@ async def validate_ticket(
for a in results
]

if not flights:
return None, None
return flights[0], None

async def insert_ticket(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ async def test_policies_search(
departure_gate="C38",
arrival_gate="D30",
),
'SELECT *<br/>FROM flights<br/>WHERE airline ILIKE UA<br/><div class="indent"></div>AND flight_number ILIKE 1158<br/><div class="indent"></div>AND departure_airport ILIKE SFO<br/><div class="indent"></div>AND departure_time = 2024-01-01 05:57:00',
None,
),
pytest.param(
{
Expand Down

0 comments on commit 1c4f4b4

Please sign in to comment.