def test_authorized_bad_url(monkeypatch, app, jwt):
    'Assert that an invalid auth service URL returns False.'
    import flask
    identifier = 'CP1234567'
    username = 'username'
    roles = [BASIC_USER]
    token = helper_create_jwt(jwt, roles=roles, username=username)
    headers = {'Authorization': ('Bearer ' + token)}

    def mock_auth(one, two):
        return headers['Authorization']
    with app.test_request_context():
        monkeypatch.setattr('flask.request.headers.get', mock_auth)
        auth_svc_url = app.config['AUTH_SVC_URL']
        app.config['AUTH_SVC_URL'] = 'http://no.way.this.works/dribble'
        rv = authorized(identifier, jwt, ['view'])
        app.config['AUTH_SVC_URL'] = auth_svc_url
    assert (not rv)
Assert that an invalid auth service URL returns False.
def test_authorized_bad_url(monkeypatch, app, jwt):
    
    import flask
    identifier = 'CP1234567'
    username = 'username'
    roles = [BASIC_USER]
    token = helper_create_jwt(jwt, roles=roles, username=username)
    headers = {'Authorization': ('Bearer ' + token)}

    def mock_auth(one, two):
        return headers['Authorization']
    with app.test_request_context():
        monkeypatch.setattr('flask.request.headers.get', mock_auth)
        auth_svc_url = app.config['AUTH_SVC_URL']
        app.config['AUTH_SVC_URL'] = 'http://no.way.this.works/dribble'
        rv = authorized(identifier, jwt, ['view'])
        app.config['AUTH_SVC_URL'] = auth_svc_url
    assert (not rv)