Merge pull request #2138 from coreos-inc/labels

Fix 500 on get label endpoint and add a test
This commit is contained in:
josephschorr 2016-11-17 16:05:12 -05:00 committed by GitHub
commit 40a9e16eed
2 changed files with 8 additions and 1 deletions

View file

@ -119,7 +119,6 @@ class ManageRepositoryManifestLabel(RepositoryParamResource):
""" Resource for managing the labels on a specific repository manifest. """
@require_repo_read
@nickname('getManifestLabel')
@parse_args()
def get(self, namespace, repository, manifestref, labelid):
""" Retrieves the label with the specific ID under the manifest. """
try:

View file

@ -4302,6 +4302,14 @@ class TestRepositoryManifestLabels(ApiTestCase):
self.assertEquals('text/plain', label2['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.
with assert_action_logged('manifest_label_delete'):
self.deleteResponse(ManageRepositoryManifestLabel,