@@ -75,7 +75,8 @@ def login(self, email):
7575
7676 def sync (self ):
7777 try :
78- hamr .sync_app (self .name )
78+ #hamr.sync_app(self.name)
79+ pass
7980 except HamrError as e :
8081 return HamrResponse (ok = False , message = str (e ))
8182
@@ -167,6 +168,8 @@ def validate(self, site):
167168 except CheckFailed as e :
168169 return status .fail (str (e ))
169170 except Exception as e :
171+ import traceback
172+ traceback .print_exc ()
170173 return status .error (str (e ))
171174
172175 def do_validate (self , site ):
@@ -327,12 +330,26 @@ def do_validate(self, site):
327330 response = site .post ("/book-ticket" , data = data )
328331 response .raise_for_status ()
329332
333+
334+ q = """SELECT * FROM booking ORDER BY id DESC LIMIT 1"""
335+ result = site .query (q )
336+ if not result :
337+ raise CheckFailed ("Could not find any bookings" )
338+
339+ row = result [0 ]
340+
341+
342+ for k in "train_number ticket_class date passenger_name passenger_email" .split ():
343+ if k not in row :
344+ raise CheckFailed (f"Missing { k !r} column in table booking" )
345+
330346 q = """
331347 SELECT
332- train_number, ticket_class, date,
333- from_station_code, to_station_code,
334- passenger_name, passenger_email
335- FROM booking
348+ b.train_number, b.ticket_class, b.date,
349+ b.passenger_name, b.passenger_email,
350+ t.from_station_code, t.to_station_code
351+ FROM booking b
352+ JOIN train t ON b.train_number=t.number
336353 ORDER BY id DESC
337354 LIMIT 1
338355 """
@@ -389,7 +406,7 @@ def __init__(self, bookings):
389406 self .passenger_email = "evaluator@example.com"
390407
391408 def get_bookings_from_html (self , html ):
392- soup = BeautifulSoup (html )
409+ soup = BeautifulSoup (html , "lxml" )
393410 booking_cards = soup .find_all ("div" , class_ = "card" )
394411 for card in booking_cards :
395412 card_header = card .find ("div" , class_ = "card-header" ).get_text ()
0 commit comments