def test_GetRepo_broken_url(repo: Optional[str], monkeypatch): # side_effect to skip hubugs.project call results = [repo, None] monkeypatch.setattr('hubugs.utils.get_git_config_val', lambda *args, **kwargs: results.pop()) with raises(ValueError): utils.get_repo()
def test_GetRepo_repo_url(repo: str, monkeypatch): # side_effect to skip hubugs.project call results = [repo, None] monkeypatch.setattr('hubugs.utils.get_git_config_val', lambda *args, **kwargs: results.pop()) assert utils.get_repo() == 'JNRowe/misc-overlay'
def test_GetRepo_config_project(monkeypatch): monkeypatch.setattr('hubugs.utils.get_git_config_val', lambda *args, **kwargs: 'JNRowe/misc-overlay') assert utils.get_repo() == 'JNRowe/misc-overlay'
def test_no_url(self, get_git_config_val): get_git_config_val.return_value = None utils.get_repo()
def test_invalid_url(self, get_git_config_val): get_git_config_val.return_value = 'http://example.com/dog.git' utils.get_repo()
def test_http_url_no_suffix_no_auth(self, get_git_config_val): get_git_config_val.return_value = \ 'http://github.com/JNRowe/misc-overlay' assert_equals(utils.get_repo(), 'JNRowe/misc-overlay')
def test_broken_url(self, get_git_config_val): get_git_config_val.return_value = 'git://github.com/misc-overlay.git' utils.get_repo()
def test_http_url(self, get_git_config_val): get_git_config_val.return_value = \ 'http://[email protected]/JNRowe/misc-overlay.git' assert_equals(utils.get_repo(), 'JNRowe/misc-overlay')
def test_ssh_url_no_suffix(self, get_git_config_val): get_git_config_val.return_value = \ '[email protected]:JNRowe/misc-overlay' assert_equals(utils.get_repo(), 'JNRowe/misc-overlay')
def test_config_project(self, get_git_config_val): # side_effect to skip hubugs.project call get_git_config_val.return_value = 'JNRowe/misc-overlay' expect(utils.get_repo()) == 'JNRowe/misc-overlay'
def test_broken_url(self, repo, get_git_config_val): # side_effect to skip hubugs.project call get_git_config_val.side_effect = [None, repo] with expect.raises(ValueError): utils.get_repo()
def test_repo_url(self, repo, get_git_config_val): # side_effect to skip hubugs.project call get_git_config_val.side_effect = [None, repo] expect(utils.get_repo()) == 'JNRowe/misc-overlay'