def test_basic_auth_custom_credentials(): """ Basic auth default credentials work. """ config = dict( basic_auth=dict( credentials=dict( username="******", ) ) ) graph = create_object_graph(name="example", testing=True, loader=lambda metadata: config) @graph.app.route("/ok") @graph.audit @graph.basic_auth.required def unauthorized(): return "OK" client = graph.app.test_client() response = client.get("/ok", headers={ "Authorization": encode_basic_auth("username", "password"), }) assert_that(response.status_code, is_(equal_to(200)))
def test_basic_auth_custom_credentials(): """ Basic auth default credentials work. """ config = dict( basic_auth=dict( credentials=dict( username="******", ) ) ) graph = create_object_graph(name="example", testing=True, loader=lambda metadata: config) @graph.app.route("/ok") @graph.audit @graph.basic_auth.required def unauthorized(): return "OK" client = graph.app.test_client() response = client.get("/ok", headers={ "Authorization": encode_basic_auth("username", "password"), }) assert_that(response.status_code, is_(equal_to(200)))
def test_basic_auth_default_credentials(): """ Basic auth default credentials work. """ graph = create_object_graph(name="example", testing=True) @graph.app.route("/ok") @graph.audit @graph.basic_auth.required def unauthorized(): return "OK" client = graph.app.test_client() response = client.get("/ok", headers={ "Authorization": encode_basic_auth("default", "secret"), }) assert_that(response.status_code, is_(equal_to(200)))
def test_basic_auth_default_credentials(): """ Basic auth default credentials work. """ graph = create_object_graph(name="example", testing=True) @graph.app.route("/ok") @graph.audit @graph.basic_auth.required def unauthorized(): return "OK" client = graph.app.test_client() response = client.get("/ok", headers={ "Authorization": encode_basic_auth("default", "secret"), }) assert_that(response.status_code, is_(equal_to(200)))