Ejemplo n.º 1
0
    def test_added_status(self, mock_log, mock_date, mock_lib, mock_body,
                          mock_mail):
        """Function:  test_added_status

        Description:  Test with status set to added.

        Arguments:

        """

        mock_date.now.return_value = self.datetime
        mock_date.strftime.return_value = self.dtg
        mock_log.return_value = True
        mock_lib.cp_file.return_value = True
        mock_lib.chk_crt_dir.return_value = True
        mock_body.return_value = True
        mock_mail.return_value = True

        self.gitr.new_files = ["File1"]

        self.assertFalse(
            merge_repo.quarantine_files(self.gitr,
                                        self.cfg,
                                        mock_log,
                                        status="added"))
Ejemplo n.º 2
0
    def test_copy_directory(self, mock_log, mock_date, mock_lib, mock_body,
                            mock_mail):
        """Function:  test_copy_directory

        Description:  Test with file in sub-directory being quarantined.

        Arguments:

        """

        mock_date.now.return_value = self.datetime
        mock_date.strftime.return_value = self.dtg
        mock_log.return_value = True
        mock_lib.cp_file.return_value = True
        mock_lib.chk_crt_dir.return_value = True
        mock_body.return_value = True
        mock_mail.return_value = True

        self.gitr.new_files = [self.pathfile]

        self.assertFalse(
            merge_repo.quarantine_files(self.gitr,
                                        self.cfg,
                                        mock_log,
                                        status="added"))
Ejemplo n.º 3
0
    def test_no_status(self, mock_log):
        """Function:  test_no_status

        Description:  Test with status not set.

        Arguments:

        """

        mock_log.return_value = True

        self.assertFalse(
            merge_repo.quarantine_files(self.gitr, self.cfg, mock_log))
Ejemplo n.º 4
0
    def test_added_no_list(self, mock_log):
        """Function:  test_added_no_list

        Description:  Test with status set to added with empty list.

        Arguments:

        """

        mock_log.return_value = True

        self.assertFalse(
            merge_repo.quarantine_files(self.gitr,
                                        self.cfg,
                                        mock_log,
                                        status="added"))
Ejemplo n.º 5
0
    def test_no_email(self, mock_log, mock_date, mock_lib):
        """Function:  test_no_email

        Description:  Test with no email notifications.

        Arguments:

        """

        mock_date.now.return_value = self.datetime
        mock_date.strftime.return_value = self.dtg
        mock_log.return_value = True
        mock_lib.cp_file.return_value = True
        mock_lib.chk_crt_dir.return_value = True

        self.gitr.new_files = ["File1"]
        self.cfg.to_line = None

        self.assertFalse(
            merge_repo.quarantine_files(self.gitr,
                                        self.cfg,
                                        mock_log,
                                        status="added"))