Merge branch 'newchanges' into python-registry-v2
This commit is contained in:
commit
7efa6265bf
6 changed files with 26 additions and 44 deletions
|
@ -5,12 +5,13 @@ from digest.digest_tools import Digest, content_path, InvalidDigestException
|
|||
class TestParseDigest(unittest.TestCase):
|
||||
def test_parse_good(self):
|
||||
examples = [
|
||||
('tarsum.v123123+sha1:123deadbeef', ('sha1', '123deadbeef', True, 'v123123')),
|
||||
('tarsum.v1+sha256:123123', ('sha256', '123123', True, 'v1')),
|
||||
('tarsum.v0+md5:abc', ('md5', 'abc', True, 'v0')),
|
||||
('sha1:123deadbeef', ('sha1', '123deadbeef', False, None)),
|
||||
('sha256:123123', ('sha256', '123123', False, None)),
|
||||
('md5:abc', ('md5', 'abc', False, None)),
|
||||
('tarsum.v123123+sha1:123deadbeef', ('tarsum.v123123+sha1', '123deadbeef')),
|
||||
('tarsum.v1+sha256:123123', ('tarsum.v1+sha256', '123123')),
|
||||
('tarsum.v0+md5:abc', ('tarsum.v0+md5', 'abc')),
|
||||
('tarsum+sha1:abc', ('tarsum+sha1', 'abc')),
|
||||
('sha1:123deadbeef', ('sha1', '123deadbeef')),
|
||||
('sha256:123123', ('sha256', '123123')),
|
||||
('md5:abc', ('md5', 'abc')),
|
||||
]
|
||||
|
||||
for digest, output_args in examples:
|
||||
|
@ -21,9 +22,7 @@ class TestParseDigest(unittest.TestCase):
|
|||
|
||||
def test_parse_fail(self):
|
||||
examples = [
|
||||
'tarsum.v++sha1:123deadbeef',
|
||||
'.v1+sha256:123123',
|
||||
'tarsum.v+md5:abc',
|
||||
'tarsum.v+md5:abc:',
|
||||
'sha1:123deadbeefzxczxv',
|
||||
'sha256123123',
|
||||
'tarsum.v1+',
|
||||
|
@ -45,6 +44,8 @@ class TestDigestPath(unittest.TestCase):
|
|||
('sha256:123123', 'sha256/12/123123'),
|
||||
('md5:abc', 'md5/ab/abc'),
|
||||
('md5:1', 'md5/01/1'),
|
||||
('md5.....+++:1', 'md5/01/1'),
|
||||
('.md5.:1', 'md5/01/1'),
|
||||
]
|
||||
|
||||
for digest, path in examples:
|
||||
|
|
Reference in a new issue