Exemple #1
0
def test_navitia_unauthorized():
    n = Navitia('http://api.navitia.io', 'jdr')
    with HTTMock(navitia_mock_navitia_unauthorized):
        try:
            n._navitia_caller('http://api.navitia.io')
        except exceptions.Unauthorized as e:
            eq_(e.message, 'test unauthorized')
            raise
Exemple #2
0
def test_navitia_retry():
    n = Navitia('http://api.navitia.io', 'jdr')

    def navitia_timeout_response(*args, **kwargs):
        global navitia_timeout_count
        navitia_timeout_count += 1
        raise requests.exceptions.Timeout
    requests.get = navitia_timeout_response
    n._navitia_caller('http://api.navitia.io')
    eq_(navitia_timeout_count, 3)
Exemple #3
0
def test_navitia_retry():
    n = Navitia('http://api.navitia.io', 'jdr')

    def navitia_timeout_response(*args, **kwargs):
        global navitia_timeout_count
        navitia_timeout_count += 1
        raise requests.exceptions.Timeout

    requests.get = navitia_timeout_response
    n._navitia_caller('http://api.navitia.io')
    eq_(navitia_timeout_count, 3)