Example #1
0
    def test_is_remote_true(self, mock_log, mock_lib, mock_isgit, mock_git,
                            mock_post, mock_chg):

        """Function:  test_is_remote_true

        Description:  Test with is_remote set to True.

        Arguments:

        """

        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_isgit.return_value = True
        mock_git.GitMerge.return_value = merge_repo.git_class.GitMerge
        mock_git.create_gitrepo.return_value = True
        mock_git.GitConfig.return_value = merge_repo.git_class.GitConfig
        mock_git.GitConfig.set_user.return_value = True
        mock_git.GitConfig.set_email.return_value = True
        mock_git.GitMerge.set_remote.return_value = True
        mock_git.GitMerge.is_remote.return_value = True
        mock_git.GitMerge.is_dirty.return_value = True
        mock_git.GitMerge.is_untracked.return_value = True
        mock_post.return_value = True
        mock_chg.return_value = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #2
0
    def test_second_check_false(self, mock_lib, mock_git, mock_log, mock_head):

        """Function:  test_second_check_false

        Description:  Test with second check set to False.

        Arguments:

        """

        mock_head.return_value = (True, None)
        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_git.GitConfig.return_value = merge_repo.git_class.GitConfig
        mock_git.GitConfig.set_user.return_value = True
        mock_git.GitConfig.set_email.return_value = True
        mock_git.GitMerge.return_value = merge_repo.git_class.GitMerge
        mock_git.GitMerge.create_gitrepo.return_value = True
        mock_git.GitMerge.set_remote.return_value = True
        mock_git.GitMerge.is_remote.return_value = True
        mock_git.GitMerge.is_dirty.return_value = False
        mock_git.GitMerge.is_untracked.return_value = False
        mock_git.GitMerge.process_dirty.return_value = True
        mock_git.GitMerge.process_untracked.return_value = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #3
0
    def test_detach_head_false(self, mock_lib, mock_git, mock_log, mock_head):

        """Function:  test_detach_head_false

        Description:  Test with detaching head returns False.

        Arguments:

        """

        mock_head.return_value = (False, "Error Message")
        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_git.GitConfig.return_value = merge_repo.git_class.GitConfig
        mock_git.GitConfig.set_user.return_value = True
        mock_git.GitConfig.set_email.return_value = True
        mock_git.GitMerge.return_value = merge_repo.git_class.GitMerge
        mock_git.GitMerge.create_gitrepo.return_value = True
        mock_git.GitMerge.set_remote.return_value = True
        mock_git.GitMerge.is_remote.return_value = True
        mock_git.GitMerge.is_dirty.return_value = False
        mock_git.GitMerge.is_untracked.return_value = False
        mock_git.GitMerge.process_dirty.return_value = True
        mock_git.GitMerge.process_untracked.return_value = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #4
0
    def test_git_alias_option(self, mock_log, mock_lib, mock_isgit, mock_git,
                              mock_post):

        """Function:  test_git_alias_option

        Description:  Test with the git alias option set to True.

        Arguments:

        """

        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_isgit.return_value = True
        mock_git.GitConfig.return_value = merge_repo.git_class.GitConfig
        mock_git.GitConfig.set_user.return_value = True
        mock_git.GitConfig.set_email.return_value = True
        mock_git.GitMerge.return_value = merge_repo.git_class.GitMerge
        mock_git.GitMerge.create_gitrepo.return_value = False
        mock_git.GitMerge.set_remote.return_value = True
        mock_git.GitMerge.is_remote.return_value = False
        mock_post.return_value = True
        self.args["-a"] = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #5
0
    def test_is_git_repo_false(self, mock_log, mock_lib, mock_isgit, mock_mail,
                               mock_move):

        """Function:  test_is_git_repo_false

        Description:  Test with is_git_repo set to False.

        Arguments:

        """

        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_isgit.return_value = False
        mock_mail.return_value = True
        mock_move.return_value = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #6
0
    def test_no_email(self, mock_log, mock_lib, mock_isgit, mock_move):

        """Function:  test_no_email

        Description:  Test with no email notifications sent.

        Arguments:

        """

        self.cfg.to_line = None

        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_isgit.return_value = False
        mock_move.return_value = True

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))
Example #7
0
    def test_not_dirty(self, mock_log, mock_lib, mock_git, mock_head):

        """Function:  test_not_dirty

        Description:  Test with no dirty files found.

        Arguments:

        """

        mock_head.return_value = (True, None)
        mock_log.return_value = True
        mock_lib.mv_file2.return_value = True
        mock_git.GitConfig.return_value = merge_repo.git_class.GitConfig
        mock_git.GitConfig.set_user.return_value = True
        mock_git.GitConfig.set_email.return_value = True
        mock_git.GitMerge.return_value = merge_repo.git_class.GitMerge
        mock_git.GitMerge.create_gitrepo.return_value = True
        mock_git.GitMerge.set_remote.return_value = True
        mock_git.GitMerge.is_remote.return_value = True
        mock_git.GitMerge.is_dirty.side_effect = [False, False]
        mock_git.GitMerge.is_untracked.side_effect = [False, False]

        self.assertFalse(merge_repo.merge(self.args, self.cfg, mock_log))