tcl: add availability check (#35909)

This commit is contained in:
Frédéric Péters 2019-09-07 17:05:26 +02:00
parent c803ac7552
commit e0ebb3f2b6
2 changed files with 10 additions and 0 deletions

View File

@ -111,6 +111,11 @@ class Tcl(BaseResource):
return {'data': stop}
def check_status(self):
stop_object = Stop.objects.all().first()
if stop_object:
self.stop(stop_object.id)
def daily(self):
super(Tcl, self).daily()
start_update = timezone.now()

View File

@ -162,3 +162,8 @@ def test_stop_info(mocked_get, app, connector):
assert resp.json['data']['passings'][0]['line_info']['ligne'] == 'B'
assert resp.json['data']['passings_by_line'][0]['ligne'] == 'B'
assert len(resp.json['data']['passings_by_line'][0]['passings']) == 2
@mock.patch('passerelle.utils.Request.get')
def test_availability(mocked_get, app, connector):
mocked_get.side_effect = tcl_responses
connector.check_status()