add slash_join helper and tests
This commit is contained in:
parent
0dcfcebe34
commit
bf477b6b9c
2 changed files with 29 additions and 0 deletions
|
@ -6,6 +6,7 @@ from semantic_version import Version, Spec
|
|||
from util.validation import generate_valid_usernames
|
||||
from util.registry.generatorfile import GeneratorFile
|
||||
from util.registry.dockerver import docker_version
|
||||
from util.string import slash_join
|
||||
|
||||
class TestGeneratorFile(unittest.TestCase):
|
||||
def sample_generator(self):
|
||||
|
@ -174,6 +175,21 @@ class TestDockerVersionParsing(unittest.TestCase):
|
|||
self.assertTrue(spec.match(Version(match_case)),
|
||||
'Spec: %s Case: %s' % (spec, match_case))
|
||||
|
||||
|
||||
class TestSlashJoining(unittest.TestCase):
|
||||
def test_joining(self):
|
||||
test_cases = [
|
||||
(['https://github.com', '/coreos-inc/' 'quay/pull/1092/files'],
|
||||
'https://github.com/coreos-inc/quay/pull/1092/files'),
|
||||
(['https://', 'github.com/', '/coreos-inc', '/quay/pull/1092/files/'],
|
||||
'https://github.com/coreos-inc/quay/pull/1092/files'),
|
||||
]
|
||||
|
||||
for args, url in test_cases:
|
||||
joined_url = slash_join(*args)
|
||||
self.assertEquals(url, joined_url)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
Reference in a new issue