def test_help_true(self, mock_arg, mock_lib): """Function: test_help_true Description: Test main function with Help_Func returns True. Arguments: """ mock_arg.return_value = self.args mock_lib.help_func.return_value = True mock_lib.get_inst.return_value = get_inst(sys) self.assertFalse(merge_repo.main())
def test_arg_require_true(self, mock_arg, mock_lib): """Function: test_arg_require_true Description: Test main function with arg_require returns True. Arguments: """ mock_arg.arg_parse2.return_value = self.args mock_lib.help_func.return_value = False mock_lib.get_inst.return_value = get_inst(sys) mock_arg.arg_require.return_value = True self.assertFalse(merge_repo.main())
def test_adding_r_option(self, mock_arg, mock_lib): """Function: test_adding_r_option Description: Test adding -r option to args_array. Arguments: """ mock_arg.arg_parse2.return_value = self.args mock_lib.help_func.return_value = False mock_lib.get_inst.return_value = get_inst(sys) mock_arg.arg_require.return_value = True self.args.pop("-r") self.assertFalse(merge_repo.main())
def test_programlock_id(self, mock_class, mock_arg, mock_lib, mock_run): """Function: test_programlock_id Description: Test with ProgramLock with flavor id. Arguments: """ mock_class.ProgramLock.return_value = self.proglock mock_arg.arg_parse2.return_value = self.args mock_lib.help_func.return_value = False mock_lib.get_inst.return_value = get_inst(sys) mock_arg.arg_require.return_value = False mock_arg.arg_dir_chk_crt.return_value = False mock_run.return_value = True self.assertFalse(merge_repo.main())
def test_exception_handler(self, mock_lock, mock_arg, mock_lib): """Function: test_exception_handler Description: Test with exception handler. Arguments: """ mock_lock.side_effect = merge_repo.gen_class.SingleInstanceException mock_arg.arg_parse2.return_value = self.args mock_lib.help_func.return_value = False mock_lib.get_inst.return_value = get_inst(sys) mock_arg.arg_require.return_value = False mock_arg.arg_dir_chk_crt.return_value = False with gen_libs.no_std_out(): self.assertFalse(merge_repo.main())
def test_programlock_false(self, mock_lock, mock_arg, mock_lib, mock_run): """Function: test_programlock_false Description: Test with ProgramLock returns False. Arguments: """ mock_lock.side_effect = \ merge_repo.gen_class.SingleInstanceException mock_arg.arg_parse2.return_value = self.args mock_lib.help_func.return_value = False mock_lib.get_inst.return_value = get_inst(sys) mock_arg.arg_require.return_value = False mock_arg.arg_dir_chk_crt.return_value = False mock_run.return_value = True with gen_libs.no_std_out(): self.assertFalse(merge_repo.main())