Add testing of the new secscan-for-local endpoint and fix a bug

This commit is contained in:
Joseph Schorr 2016-05-04 21:47:03 -04:00
parent 67031e4e33
commit 232fa42897
3 changed files with 40 additions and 6 deletions

View file

@ -74,7 +74,7 @@ class SecurityScannerAPI(object):
repository_and_namespace = '/'.join([namespace_name, repo_name])
# Generate the JWT which will authorize this
audience = 'security_scanner'
audience = self._app.config['SERVER_HOSTNAME']
context, subject = build_context_and_subject(None, None, None)
access = [{
'type': 'repository',
@ -83,7 +83,7 @@ class SecurityScannerAPI(object):
}]
auth_jwt = generate_jwt_object(audience, subject, context, access, TOKEN_VALIDITY_LIFETIME_S,
self._config)
auth_header = 'Bearer: {}'.format(auth_jwt)
auth_header = 'Bearer {}'.format(auth_jwt)
with self._app.test_request_context('/'):
relative_layer_url = url_for('v2.download_blob', repository=repository_and_namespace,