Beispiel #1
0
    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')
Beispiel #2
0
    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')
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
 def test_unknown_hosting_service(self):
     repo_url = "http://not-identifiable-repo.com"
     data = watdarepo(repo_url)
     self.assertEqual(data['hosting_service'], None)
Beispiel #6
0
 def test_unknown_vcs(self):
     repo_url = "http://not-identifiable-repo.com"
     data = watdarepo(repo_url)
     self.assertEqual(data['vcs'], None)
Beispiel #7
0
 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')
Beispiel #8
0
 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')
Beispiel #9
0
 def test_unknown_hosting_service(self):
     repo_url = "http://not-identifiable-repo.com"
     data = watdarepo(repo_url)
     self.assertEqual(data['hosting_service'], None)
Beispiel #10
0
 def test_unknown_vcs(self):
     repo_url = "http://not-identifiable-repo.com"
     data = watdarepo(repo_url)
     self.assertEqual(data['vcs'], None)
Beispiel #11
0
 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')
Beispiel #12
0
 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')