示例#1
0
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
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
 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
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
 def test_invalid_key(self, check_output):
     check_output.return_value = ''
     assert_equals(utils.get_git_config_val('no_such_key'), '')
示例#6
0
 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')) == ''