mirror of https://github.com/docker/docker-py.git
Python, not Go
This commit is contained in:
parent
cdfe299007
commit
de066a1ae6
|
@ -131,10 +131,10 @@ def convert_volume_binds(binds):
|
|||
def parse_repository_tag(repo):
|
||||
column_index = repo.rfind(':')
|
||||
if column_index < 0:
|
||||
return repo, ""
|
||||
return repo, None
|
||||
tag = repo[column_index+1:]
|
||||
slash_index = tag.find('/')
|
||||
if slash_index < 0:
|
||||
return repo[:column_index], tag
|
||||
|
||||
return repo, ""
|
||||
return repo, None
|
||||
|
|
|
@ -7,15 +7,15 @@ class UtilsTest(unittest.TestCase):
|
|||
|
||||
def test_parse_repository_tag(self):
|
||||
self.assertEqual(parse_repository_tag("root"),
|
||||
("root", ""))
|
||||
("root", None))
|
||||
self.assertEqual(parse_repository_tag("root:tag"),
|
||||
("root", "tag"))
|
||||
self.assertEqual(parse_repository_tag("user/repo"),
|
||||
("user/repo", ""))
|
||||
("user/repo", None))
|
||||
self.assertEqual(parse_repository_tag("user/repo:tag"),
|
||||
("user/repo", "tag"))
|
||||
self.assertEqual(parse_repository_tag("url:5000/repo"),
|
||||
("url:5000/repo", ""))
|
||||
("url:5000/repo", None))
|
||||
self.assertEqual(parse_repository_tag("url:5000/repo:tag"),
|
||||
("url:5000/repo", "tag"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue