Convert V2's manifest endpoints to use the new data model interface
This commit is contained in:
parent
a172de4fdc
commit
6b5064aba4
10 changed files with 197 additions and 200 deletions
|
@ -51,7 +51,7 @@ class V2Protocol(RegistryProtocol):
|
|||
Failures.MISSING_TAG: 404,
|
||||
Failures.INVALID_TAG: 404,
|
||||
Failures.INVALID_IMAGES: 400,
|
||||
Failures.INVALID_BLOB: 404,
|
||||
Failures.INVALID_BLOB: 400,
|
||||
Failures.UNSUPPORTED_CONTENT_TYPE: 415,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -678,9 +678,9 @@ class V2RegistryPushMixin(V2RegistryMixin):
|
|||
for tag_name in tag_names:
|
||||
manifest = manifests[tag_name]
|
||||
|
||||
# Write the manifest. If we expect it to be invalid, we expect a 404 code. Otherwise, we expect
|
||||
# Write the manifest. If we expect it to be invalid, we expect a 400 code. Otherwise, we expect
|
||||
# a 202 response for success.
|
||||
put_code = 404 if invalid else 202
|
||||
put_code = 400 if invalid else 202
|
||||
self.conduct('PUT', '/v2/%s/manifests/%s' % (repo_name, tag_name),
|
||||
data=manifest.bytes, expected_code=put_code,
|
||||
headers={'Content-Type': 'application/json'}, auth='jwt')
|
||||
|
@ -1682,9 +1682,9 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
manifest = builder.build(_JWK)
|
||||
|
||||
response = self.conduct('PUT', '/v2/%s/manifests/%s' % (repo_name, tag_name),
|
||||
data=manifest.bytes, expected_code=404,
|
||||
data=manifest.bytes, expected_code=400,
|
||||
headers={'Content-Type': 'application/json'}, auth='jwt')
|
||||
self.assertEquals('BLOB_UNKNOWN', response.json()['errors'][0]['code'])
|
||||
self.assertEquals('MANIFEST_INVALID', response.json()['errors'][0]['code'])
|
||||
|
||||
|
||||
def test_delete_manifest(self):
|
||||
|
|
Reference in a new issue