diff --git a/module_build_service/scm.py b/module_build_service/scm.py index 58f0136d..79267cb3 100644 --- a/module_build_service/scm.py +++ b/module_build_service/scm.py @@ -63,6 +63,8 @@ class SCM(object): raise Unauthorized( '%s is not in the list of allowed SCMs' % url) + url = url.rstrip('/') + self.url = url # once we have more than one SCM provider, we will need some more diff --git a/tests/test_scm.py b/tests/test_scm.py index 40ed1258..8e224804 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -65,3 +65,13 @@ class TestSCMModule(unittest.TestCase): fname = tempfile.mktemp(suffix='mbs-scm-test') scm.get_latest(branch='master; touch %s' % fname) assert not os.path.exists(fname), "%r exists! Vulnerable." % fname + + def test_local_extract_name(self): + scm = module_build_service.scm.SCM(repo_path) + target = 'testrepo' + assert scm.name == target, '%r != %r' % (scm.name, target) + + def test_local_extract_name_trailing_slash(self): + scm = module_build_service.scm.SCM(repo_path + '/') + target = 'testrepo' + assert scm.name == target, '%r != %r' % (scm.name, target)