示例#1
0
 def test_git_validate_git_sanity(self, mock_popen, mock_conf):
     """Test that no exception is raised when calling validate_git."""
     my_pipe = mock.MagicMock()
     my_pipe.communicate = mock.MagicMock(return_value=(
         '1',
         '2',
     ))
     mock_popen.return_value = my_pipe
     test_git = git_native.GitNative()
     test_git.validate_git()
示例#2
0
 def test_git_upload_changes_error(self, mock_popen, mock_conf):
     """Test that an exception is raised when stderror returns error."""
     my_pipe = mock.MagicMock()
     my_pipe.communicate = mock.MagicMock(return_value=(
         '1',
         'error',
     ))
     mock_popen.return_value = my_pipe
     test_git = git_native.GitNative()
     self.assertRaises(git_native.GitUploadError,
                       test_git.git_upload_changes)
示例#3
0
 def test_git_native_validate_git_config_fail(self, conf, mock_popen,
                                              result):
     """Test that no exception is raised when calling git_init.aein"""
     my_pipe = mock.MagicMock()
     my_pipe.communicate = mock.MagicMock(return_value=(
         '1',
         '2',
     ))
     mock_popen.return_value = my_pipe
     test_git = git_native.GitNative()
     with self.assertRaises(GitValidateError):
         test_git.validate_git()