]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add tests for suite.expand_short_repo_name()
authorZack Cerza <zack@redhat.com>
Fri, 16 Dec 2016 22:11:40 +0000 (15:11 -0700)
committerZack Cerza <zack@redhat.com>
Fri, 16 Dec 2016 22:11:40 +0000 (15:11 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/suite/test/test_init.py

index 78a6f21300d19956d3906ddf7d63bb327cf68d59..c347141e14d024c456e98689a77e6eb53d41730a 100644 (file)
@@ -103,6 +103,31 @@ def test_wait_fails(m_get_jobs):
         suite.wait('name', 1, None)
 
 
+REPO_SHORTHAND = [
+    ['https://github.com/dude/foo', 'bar',
+     'https://github.com/dude/bar'],
+    ['https://github.com/dude/foo/', 'bar',
+     'https://github.com/dude/bar/'],
+    ['https://github.com/ceph/ceph', 'ceph',
+     'https://github.com/ceph/ceph'],
+    ['https://github.com/ceph/ceph', 'ceph-ci',
+     'https://github.com/ceph/ceph-ci'],
+    ['https://github.com/ceph/ceph-ci', 'ceph',
+     'https://github.com/ceph/ceph'],
+    ['git://git.ceph.com/ceph.git', 'ceph',
+     'git://git.ceph.com/ceph.git'],
+    ['git://git.ceph.com/ceph.git', 'ceph-ci',
+     'git://git.ceph.com/ceph-ci.git'],
+    ['git://git.ceph.com/ceph-ci.git', 'ceph',
+     'git://git.ceph.com/ceph.git'],
+]
+
+
+@pytest.mark.parametrize(['orig', 'shorthand', 'result'], REPO_SHORTHAND)
+def test_expand_short_repo_name(orig, shorthand, result):
+    assert suite.expand_short_repo_name(shorthand, orig) == result
+
+
 class TestSuiteMain(object):
     def test_main(self):
         suite_name = 'SUITE'