def test_custom(self): # bzr on kiln is NOT an actual thing. hosting_services = tuple(list(HOSTING_SERVICES) + ['kiln']) repo_aliases = tuple(list(REPO_ALIASES) + ['bzr']) repo_url = "http://example.kiln.com/myrepo.bzr" data = watdarepo(repo_url, guess=True, repo_aliases=repo_aliases, hosting_services=hosting_services) self.assertEqual(data['vcs'], u'bzr') self.assertEqual(data['hosting_service'], u'kiln')
def parse_vcs_url(url): wat = watdarepo(url) parts = { "vcs": wat["vcs"], "host": wat["hosting_service"], "url": url, } if wat["vcs"] == "git": parsed = giturlparse(url) if not parsed.valid: raise URLFormatError(url) parts["host"] = parsed.host parts["owner"] = parsed.owner parts["repo"] = parsed.repo parts["url"] = parsed.url2ssh parts["slug"] = slugify_vcs_url(parts["url"]) while parts["host"] and "." in parts["host"]: parts["host"] = parts["host"].partition(".")[0] return parts
def test_unknown_hosting_service(self): repo_url = "http://not-identifiable-repo.com" data = watdarepo(repo_url) self.assertEqual(data['hosting_service'], None)
def test_unknown_vcs(self): repo_url = "http://not-identifiable-repo.com" data = watdarepo(repo_url) self.assertEqual(data['vcs'], None)
def test_github_object_mode(self): repo_url = "[email protected]:pydanny/watdarepo.git" data = watdarepo(repo_url, mode='c') self.assertEqual(data.vcs, u'git') self.assertEqual(data.hosting_service, u'github')
def test_github(self): repo_url = "[email protected]:pydanny/watdarepo.git" data = watdarepo(repo_url) self.assertEqual(data['vcs'], u'git') self.assertEqual(data['hosting_service'], u'github')