def test_svn_repoc_hash_wo_subdir(self): '''Test to get svn repocache dir without subdir''' scm_object = Svn(self.cli, self.tasks) scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git' repohash = scm_object.get_repocache_hash('') self.assertEqual( repohash, 'd5a57bc8ad6a3ecbca514a1a6fb48e2c9ee183ceb5f7d42e9fd5836918bd540c')
def test_svn_repoc_hash_w_subdir(self): ''' This test case proves that subdir is ignored in TarSCM.base.scm.get_repocache_hash ''' scm_object = Svn(self.cli, self.tasks) scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git' repohash = scm_object.get_repocache_hash('subdir') self.assertEqual( repohash, 'b9761648b96f105d82a97b8a81f1ca060b015a3f882ef9a55ae6b5bf7be0d48a')
def test_check_url_valid(self): tc_arr = [ { 'obj': Git(self.cli, self.tasks), 'urls': [ 'http://example.com', 'https://example.com', 'ftp://example.com', 'ftps://example.com', 'git://example.com', 'ssh://example.com', 'example.com:/path/to/remote/repo', '[email protected]:/path/to/remote/repo', '[email protected]:/path/to/remote/repo', '[email protected]:/path/to/remote/repo', ] }, { 'obj': Bzr(self.cli, self.tasks), 'urls': [ 'http://example.com', 'https://example.com', 'ftp://example.com', 'aftp://example.com', 'bzr://example.com', 'lp://example.com', ] }, { 'obj': Hg(self.cli, self.tasks), 'urls': [ 'http://example.com', 'https://example.com', ] }, { 'obj': Svn(self.cli, self.tasks), 'urls': [ 'http://example.com', 'https://example.com', 'svn://example.com', ] }, ] for tca in tc_arr: for url in tca['urls']: tca['obj'].url = url self.assertTrue(tca['obj'].check_url())
def test_check_url_invalid(self): invalid = [ 'Xhttp://example.com', 'Xhttps://example.com', 'Xftp://example.com', 'Xftps://example.com', 'Xaftp://example.com', 'Xbzr://example.com', 'Xlp://example.com', 'Xgit://example.com', 'Xssh://example.com', 'Xsvn://example.com', '/lala/nana', '/tmp/[email protected]:my/local/path' '/tmp/example.com:my/local/path' ] scms = [ Git(self.cli, self.tasks), Bzr(self.cli, self.tasks), Hg(self.cli, self.tasks), Svn(self.cli, self.tasks), ] for scm in scms: for url in invalid: print("%r %s" % (scm, url)) scm.url = url self.assertFalse(scm.check_url())