コード例 #1
0
ファイル: test_utils.py プロジェクト: JNRowe/hubugs
def test_GetGitConfigVal_invalid_key(monkeypatch):
    monkeypatch.setattr('subprocess.check_output', lambda *args, **kwargs: b'')

    assert utils.get_git_config_val('no_such_key') == ''
コード例 #2
0
ファイル: test_utils.py プロジェクト: JNRowe/hubugs
def test_GetGitConfigVal_command_error(monkeypatch):
    def raise_error(*args, **kwargs):
        raise CalledProcessError('255', 'cmd')
    monkeypatch.setattr('subprocess.check_output', raise_error)

    assert utils.get_git_config_val('github.user') is None
コード例 #3
0
ファイル: test_utils.py プロジェクト: sorin-ionescu/hubugs
 def test_command_error(self, check_output):
     check_output.side_effect = CalledProcessError('255', 'cmd')
     assert_equals(utils.get_git_config_val('github.user'), None)
コード例 #4
0
ファイル: test_utils.py プロジェクト: JNRowe/hubugs
def test_GetGitConfigVal_valid_key(monkeypatch):
    monkeypatch.setattr('subprocess.check_output',
                        lambda *args, **kwargs: b'JNRowe')

    assert utils.get_git_config_val('github.user') == 'JNRowe'
コード例 #5
0
ファイル: test_utils.py プロジェクト: sorin-ionescu/hubugs
 def test_invalid_key(self, check_output):
     check_output.return_value = ''
     assert_equals(utils.get_git_config_val('no_such_key'), '')
コード例 #6
0
ファイル: test_utils.py プロジェクト: sorin-ionescu/hubugs
 def test_valid_key(self, check_output):
     check_output.return_value = 'JNRowe'
     assert_equals(utils.get_git_config_val('github.user'), 'JNRowe')
コード例 #7
0
 def test_valid_key(self, check_output):
     check_output.return_value = 'JNRowe'
     expect(utils.get_git_config_val('github.user')) == 'JNRowe'
コード例 #8
0
 def test_command_error(self, check_output):
     check_output.side_effect = CalledProcessError('255', 'cmd')
     expect(utils.get_git_config_val('github.user')) is None
コード例 #9
0
 def test_invalid_key(self, check_output):
     check_output.return_value = ''
     expect(utils.get_git_config_val('no_such_key')) == ''