def make_url_test(): cleverage = Cleverage(id='tata', timezone='Europe/Paris', service_url='http://bob.com/', service_args={'a': 'bobette', 'b': '12'}) url = cleverage._make_url(MockRoutePoint(line_code='line_toto', stop_id='stop_tutu')) # it should be a valid url assert validators.url(url) assert url == 'http://bob.com/stop_tutu'
def make_url_invalid_code_test(): """ test make_url when RoutePoint does not have a mandatory code we should not get any url """ cleverage = Cleverage(id='tata', timezone='Europe/Paris', service_url='http://bob.com/', service_args={'a': 'bobette', 'b': '12'}) url = cleverage._make_url(MockRoutePoint(line_code='line_toto', stop_id=None)) assert url is None