Ejemplo n.º 1
0
def test_get_repo_name_from_url():
    ret = get_repo_name_from_url('file:///tmp/project.git')
    assert ret == 'project'

    ret = get_repo_name_from_url('file:///tmp/python-gitview.git')
    assert ret == 'python-gitview'

    ret = get_repo_name_from_url('https://github.com/python-gitview.git')
    assert ret == 'python-gitview'

    ret = get_repo_name_from_url('https://github.com/python-gitview')
    assert ret == 'python-gitview'
Ejemplo n.º 2
0
 def save(self, *args, **kwargs):
     if len(self.name) == 0:
         self.name = get_repo_name_from_url(self.url)
     return super(Project, self).save(*args, **kwargs)