Test that we can clone repos with a trailing slash.

This commit is contained in:
Ralph Bean
2017-02-20 12:44:49 -05:00
parent 2e6e153660
commit 0ffb1f7e42
2 changed files with 12 additions and 0 deletions

View File

@@ -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

View File

@@ -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)