Fix issue with Docker 1.8.3 and pulling public repos with no creds
We now return the valid subset of auth scopes requested. Adds a test for this case and adds testing of all returned JWTs in the V2 login tests
This commit is contained in:
parent
566a91f003
commit
8cd38569d6
5 changed files with 202 additions and 148 deletions
|
@ -31,7 +31,6 @@ class _SpecTestBuilder(type):
|
|||
expected_index_status = getattr(test_spec, attrs['result_attr'])
|
||||
|
||||
if attrs['auth_username']:
|
||||
expected_auth_status = getattr(test_spec, 'auth_' + attrs['result_attr'])
|
||||
|
||||
# Get a signed JWT.
|
||||
username = attrs['auth_username']
|
||||
|
@ -44,12 +43,11 @@ class _SpecTestBuilder(type):
|
|||
headers=[('authorization', test_spec.gen_basic_auth(username, password))],
|
||||
query_string=query_string)
|
||||
|
||||
msg = 'Auth failed for %s %s: got %s, expected: %s' % (
|
||||
test_spec.method_name, test_spec.index_name, arv.status_code, expected_auth_status)
|
||||
self.assertEqual(arv.status_code, expected_auth_status, msg)
|
||||
msg = 'Auth failed for %s %s: got %s, expected: 200' % (
|
||||
test_spec.method_name, test_spec.index_name, arv.status_code)
|
||||
self.assertEqual(arv.status_code, 200, msg)
|
||||
|
||||
if arv.status_code == 200:
|
||||
headers = [('authorization', 'Bearer ' + json.loads(arv.data)['token'])]
|
||||
headers = [('authorization', 'Bearer ' + json.loads(arv.data)['token'])]
|
||||
|
||||
rv = c.open(url, headers=headers, method=test_spec.method_name)
|
||||
msg = '%s %s: got %s, expected: %s (auth: %s | headers %s)' % (test_spec.method_name,
|
||||
|
|
Reference in a new issue