Merge pull request #1393 from aebm/master

Fix #1351
This commit is contained in:
Joffrey F 2017-01-19 11:55:14 -08:00 committed by GitHub
commit bb665257ed
2 changed files with 9 additions and 4 deletions

View File

@ -30,10 +30,10 @@ class Image(Model):
"""
The image's tags.
"""
return [
tag for tag in self.attrs.get('RepoTags', [])
if tag != '<none>:<none>'
]
tags = self.attrs.get('RepoTags')
if tags is None:
tags = []
return [tag for tag in tags if tag != '<none>:<none>']
def history(self):
"""

View File

@ -83,6 +83,11 @@ class ImageTest(unittest.TestCase):
})
assert image.tags == []
image = Image(attrs={
'RepoTags': None
})
assert image.tags == []
def test_history(self):
client = make_fake_client()
image = client.images.get(FAKE_IMAGE_ID)