Пример #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()