Exemplo n.º 1
0
    def runTest(self):
        self.pgagent_step_name = "test_step_add%s" % str(uuid.uuid4())[1:8]
        self.data["jstjobid"] = self.job_id
        self.data["jstname"] = self.pgagent_step_name

        if self.is_positive_test:
            response = steps_utils.api_create(self)

            # Assert response
            utils.assert_status_code(self, response)

            # Verify in backend
            response_data = json.loads(response.data)
            self.step_id = response_data['node']['_id']
            is_present = pgagent_utils.verify_pgagent_step(self)
            self.assertTrue(is_present,
                            "pgAgent step was not created successfully.")

        else:
            if self.mocking_required:
                with patch(self.mock_data["function_name"],
                           side_effect=eval(self.mock_data["return_value"])):
                    response = steps_utils.api_create(self)

                    # Assert response
                    utils.assert_status_code(self, response)
                    utils.assert_error_message(self, response)
    def runTest(self):
        """This function will deletes pgAgent job step"""
        if self.is_positive_test:
            if self.is_list:
                self.data['ids'] = [self.step_id, self.step_id_2]
                response = steps_utils.api_delete(self, '')
            else:
                response = steps_utils.api_delete(self)

            # Assert response
            utils.assert_status_code(self, response)

        is_present = pgagent_utils.verify_pgagent_step(self)
        self.assertFalse(is_present,
                         "pgAgent step was not deleted successfully")