Esempio n. 1
0
    def test_work_dir_true(self, mock_lib):
        """Function:  test_work_dir_true

        Description:  Test work_dir check returns True.

        Arguments:

        """

        mock_lib.load_module.return_value = self.cfg
        mock_lib.chk_crt_dir.side_effect = [self.true, self.true, self.true]
        mock_lib.chk_crt_file.side_effect = [self.true]

        self.assertEqual(merge_repo.load_cfg(self.cfg_name, self.cfg_dir),
                         (self.cfg, True, []))
Esempio n. 2
0
    def test_log_file_false(self, mock_lib):
        """Function:  test_log_file_false

        Description:  Test log_file check returns False.

        Arguments:

        """

        mock_lib.load_module.return_value = self.cfg
        mock_lib.chk_crt_dir.side_effect = [self.true, self.true, self.true]
        mock_lib.chk_crt_file.side_effect = [[False, self.err_msg4]]

        self.assertEqual(merge_repo.load_cfg(self.cfg_name, self.cfg_dir),
                         (self.cfg, False, [self.err_msg4]))
Esempio n. 3
0
    def test_multiple_errors(self, mock_lib):
        """Function:  test_multiple_errors

        Description:  Test with multiple errors returned.

        Arguments:

        """

        mock_lib.load_module.return_value = self.cfg
        mock_lib.chk_crt_dir.side_effect = [
            self.true, self.true, [False, self.err_msg3]
        ]
        mock_lib.chk_crt_file.side_effect = [[False, self.err_msg4]]

        self.assertEqual(merge_repo.load_cfg(self.cfg_name, self.cfg_dir),
                         (self.cfg, False, [self.err_msg3, self.err_msg4]))