Esempio n. 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') == ''
Esempio n. 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
Esempio n. 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)
Esempio n. 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'
Esempio n. 5
0
 def test_invalid_key(self, check_output):
     check_output.return_value = ''
     assert_equals(utils.get_git_config_val('no_such_key'), '')
Esempio n. 6
0
 def test_valid_key(self, check_output):
     check_output.return_value = 'JNRowe'
     assert_equals(utils.get_git_config_val('github.user'), 'JNRowe')
Esempio n. 7
0
 def test_valid_key(self, check_output):
     check_output.return_value = 'JNRowe'
     expect(utils.get_git_config_val('github.user')) == 'JNRowe'
Esempio n. 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
Esempio n. 9
0
 def test_invalid_key(self, check_output):
     check_output.return_value = ''
     expect(utils.get_git_config_val('no_such_key')) == ''