def test_kirin_delay_train_and_partial_delete(self): """ test first to send a delay on a train Then we send a partial delete (some stops are no longer served) Requested departure: 2012/11/20 19:00 From: Bordeaux-St-Jean To: Moulis-Listrac Before the delay, we should take the train 866143 travelling from 19:54 to 20:42 After the delay, we take the same train, travelling from 19:54 to 20:52 will be found The partial deletion is on the last stops [Macau, Margaux, Moulis-Listrac and Pauillac] Note: only the departure from Macau is deleted and in the IRE data the last stop is Lesparre, but it's not in the navitia's VJ (so we don't impact it) So after the partial deletion, we cannot take the same train, we take the train the day after (21/11) at 06:54 to 07:46 """ last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) send_ire('trip_delay_866143.xml') wait_for_rt_reload(last_rt_data_loaded, COVERAGE) # test that it is still OK in base-schedule self.journey(_from="stop_area:OCE:SA:87581009", to="stop_area:OCE:SA:87581231", datetime="20121120T190000", data_freshness="base_schedule") # test that the journey is delayed self.journey(_from="stop_area:OCE:SA:87581009", to="stop_area:OCE:SA:87581231", datetime="20121120T190000", data_freshness="realtime") # we also can find the disruption through the VJ self.api('trips/OCE:SN866143F01001/disruptions') # we then send the partial delete last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) send_ire('trip_partially_deleted_866143.xml') wait_for_rt_reload(last_rt_data_loaded, COVERAGE) # test that it is still OK in base-schedule self.journey(_from="stop_area:OCE:SA:87581009", to="stop_area:OCE:SA:87581231", datetime="20121120T190000", data_freshness="base_schedule") # but now in real time we take the next train self.journey(_from="stop_area:OCE:SA:87581009", to="stop_area:OCE:SA:87581231", datetime="20121120T190000", data_freshness="realtime") # we still can find 1 (and only one) disruption (mixing delay and partial deletion) self.api('trips/OCE:SN866143F01001/disruptions')
def test_kirin_cancel_train(self): """ test cancellation of the train Requested departure: 2012/12/15 16:30 From: Gare de Lyon, Paris To: Saint Charles, Marseille Before the cancellation, we should find a train travelling from 16:37 to 19:50 After the cancellation, a train travelling from 17:07 to 20:24 will be found """ last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) # TGV send_ire('trip_removal_tgv_6121.xml') wait_for_rt_reload(last_rt_data_loaded, COVERAGE) # test that it is still OK in base-schedule self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121215T1630", data_freshness="base_schedule") # test that RT is disrupted self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121215T1630", data_freshness="realtime") self.api( 'vehicle_journeys/vehicle_journey:OCE:SN006121F02003/disruptions') # test of departures with a cancelled train # in realtime we should have 6 passages, and in base_schedule we should have 7 # the addditional passage should be the one at 20121215T163700 self.api( 'stop_areas/stop_area:OCE:SA:87686006/' 'lines/line:OCE:TGV-87751008-87686006/departures?from_datetime=20121215T1630' ) self.api('stop_areas/stop_area:OCE:SA:87686006/' 'lines/line:OCE:TGV-87751008-87686006/departures' '?from_datetime=20121215T1630&data_freshness=base_schedule')
def test_kirin_cancel_train(self): """ test cancellation of the train Requested departure: 2012/12/15 16:30 From: Gare de Lyon, Paris To: Saint Charles, Marseille Before the cancellation, we should find a train travelling from 16:37 to 19:50 After the cancellation, a train travelling from 17:07 to 20:24 will be found """ last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) # TGV send_ire('trip_removal_tgv_6121.xml') wait_for_rt_reload(last_rt_data_loaded, COVERAGE) # test that it is still OK in base-schedule self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121215T1630", data_freshness="base_schedule") # test that RT is disrupted self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121215T1630", data_freshness="realtime") self.api('vehicle_journeys/vehicle_journey:OCE:SN006121F02003/disruptions') # test of departures with a cancelled train # in realtime we should have 6 passages, and in base_schedule we should have 7 # the addditional passage should be the one at 20121215T163700 self.api('stop_areas/stop_area:OCE:SA:87686006/' 'lines/line:OCE:TGV-87751008-87686006/departures?from_datetime=20121215T1630') self.api('stop_areas/stop_area:OCE:SA:87686006/' 'lines/line:OCE:TGV-87751008-87686006/departures' '?from_datetime=20121215T1630&data_freshness=base_schedule')
def test_kirin_repeat_the_same_ire_and_reload_from_scratch(self): """ test cancellation of the train Requested departure: 2012/12/20 17:00 From: Gare de Lyon, Paris To: Saint Charles, Marseille After the cancellation, a train travelling from 18:19 to 21:29 should be found """ last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) for i in range(5): send_ire('trip_removal_tgv_6123.xml') wait_for_rt_reload(last_rt_data_loaded, COVERAGE) self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121220T1700", data_freshness="realtime") """ At this point, an IRE is saved into the db, now we'll test the case where kraken is run from scratch and the previous IRE should be taken into account """ last_rt_data_loaded = get_last_rt_loaded_time(COVERAGE) self.kill_the_krakens() self.pop_krakens() wait_for_rt_reload(last_rt_data_loaded, COVERAGE) self.journey(_from="stop_area:OCE:SA:87686006", to="stop_area:OCE:SA:87751008", datetime="20121220T1700", data_freshness="realtime")