Merge pull request #2138 from coreos-inc/labels
Fix 500 on get label endpoint and add a test
This commit is contained in:
commit
40a9e16eed
2 changed files with 8 additions and 1 deletions
|
@ -119,7 +119,6 @@ class ManageRepositoryManifestLabel(RepositoryParamResource):
|
||||||
""" Resource for managing the labels on a specific repository manifest. """
|
""" Resource for managing the labels on a specific repository manifest. """
|
||||||
@require_repo_read
|
@require_repo_read
|
||||||
@nickname('getManifestLabel')
|
@nickname('getManifestLabel')
|
||||||
@parse_args()
|
|
||||||
def get(self, namespace, repository, manifestref, labelid):
|
def get(self, namespace, repository, manifestref, labelid):
|
||||||
""" Retrieves the label with the specific ID under the manifest. """
|
""" Retrieves the label with the specific ID under the manifest. """
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -4302,6 +4302,14 @@ class TestRepositoryManifestLabels(ApiTestCase):
|
||||||
self.assertEquals('text/plain', label2['label']['media_type'])
|
self.assertEquals('text/plain', label2['label']['media_type'])
|
||||||
self.assertEquals('application/json', label3['label']['media_type'])
|
self.assertEquals('application/json', label3['label']['media_type'])
|
||||||
|
|
||||||
|
# Ensure we can retrieve each of the labels.
|
||||||
|
for label in json['labels']:
|
||||||
|
label_json = self.getJsonResponse(ManageRepositoryManifestLabel,
|
||||||
|
params=dict(repository=repository,
|
||||||
|
manifestref=tag_manifest.digest,
|
||||||
|
labelid=label['id']))
|
||||||
|
self.assertEquals(label['id'], label_json['id'])
|
||||||
|
|
||||||
# Delete a label.
|
# Delete a label.
|
||||||
with assert_action_logged('manifest_label_delete'):
|
with assert_action_logged('manifest_label_delete'):
|
||||||
self.deleteResponse(ManageRepositoryManifestLabel,
|
self.deleteResponse(ManageRepositoryManifestLabel,
|
||||||
|
|
Reference in a new issue