Example #1
0
    def test_func_call_zero(self, mock_lock, mock_class, mock_load):
        """Function:  test_func_call_zero

        Description:  Test run_program function with zero calls to function.

        Arguments:

        """

        mock_lock.return_value = self.proglock
        mock_class.return_value = "Elastic_Class"
        mock_load.return_value = self.cfg

        self.assertFalse(elastic_db_repo.run_program(self.args,
                                                     self.func_dict))
Example #2
0
    def test_programlock_id(self, mock_lock, mock_class, mock_load):
        """Function:  test_programlock_id

        Description:  Test ProgramLock with flavor ID.

        Arguments:

        """

        self.args["-U"] = True

        mock_lock.return_value = self.proglock
        mock_class.return_value = "Elastic_Class"
        mock_load.return_value = self.cfg

        self.assertFalse(elastic_db_repo.run_program(self.args,
                                                     self.func_dict))
Example #3
0
    def test_func_call_multi(self, mock_lock, mock_class, mock_load):
        """Function:  test_func_call_multi

        Description:  Test run_program function with multiple calls to
            function.

        Arguments:

        """

        self.args["-U"] = True
        self.args["-R"] = True

        mock_lock.return_value = self.proglock
        mock_class.return_value = "Elastic_Class"
        mock_load.return_value = self.cfg

        self.assertFalse(elastic_db_repo.run_program(self.args,
                                                     self.func_dict))
Example #4
0
    def test_exception_handler(self, mock_lock, mock_class, mock_load):
        """Function:  test_exception_handler

        Description:  Test with exception handler.

        Arguments:

        """

        self.args["-U"] = True

        mock_lock.side_effect = \
            elastic_db_repo.gen_class.SingleInstanceException
        mock_class.return_value = "Elastic_Class"
        mock_load.return_value = self.cfg

        with gen_libs.no_std_out():
            self.assertFalse(
                elastic_db_repo.run_program(self.args, self.func_dict))