示例#1
0
def make_url_test():
    sytral = Sytral(id='tata', service_url='http://bob.com/')

    url = sytral._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_id=stop_tutu'
示例#2
0
def make_url_invalid_code_test():
    """
    test make_url when RoutePoint does not have a mandatory code

    we should not get any url
    """
    sytral = Sytral(id='tata', service_url='http://bob.com/')

    url = sytral._make_url(MockRoutePoint(line_code='line_toto', stop_id=None))

    assert url is None