DEV: Allow configuration of default headers.

Applies Content-Security-Policy: frame-ancestors 'self' by default.
This commit is contained in:
Scott Sanderson
2015-04-23 18:46:56 -04:00
parent 1674d2f698
commit 74d3740921
2 changed files with 15 additions and 2 deletions

View File

@@ -60,11 +60,13 @@ def api_request(app, *api_path, **kwargs):
if 'Authorization' not in headers:
headers.update(auth_header(app.db, 'admin'))
url = ujoin(base_url, 'api', *api_path)
method = kwargs.pop('method', 'get')
f = getattr(requests, method)
return f(url, **kwargs)
resp = f(url, **kwargs)
assert resp.headers['Content-Security-Policy'] == "frame-ancestors 'self'"
return resp
def test_auth_api(app):
db = app.db