Пример #1
0
    def test_task_validate(self, mock_engine, mock_deployment_get, mock_task):
        api.task_validate(self.deploy_uuid, "config")

        mock_engine.assert_has_calls([
            mock.call("config", mock_task.return_value),
            mock.call().bind(admin=mock_deployment_get.return_value["admin"],
                             users=[]),
            mock.call().validate(),
        ])

        mock_task.assert_called_once_with(deployment_uuid=self.deploy_uuid)
        mock_deployment_get.assert_called_once_with(self.deploy_uuid)
Пример #2
0
    def test_task_validate(self, mock_engine, mock_deployment_get, mock_task):
        api.task_validate(mock_deployment_get.return_value["uuid"], "config")

        mock_engine.assert_has_calls([
            mock.call("config", mock_task.return_value,
                      admin=mock_deployment_get.return_value["admin"],
                      users=[]),
            mock.call().validate()
        ])

        mock_task.assert_called_once_with(
            deployment_uuid=mock_deployment_get.return_value["uuid"])
        mock_deployment_get.assert_called_once_with(
            mock_deployment_get.return_value["uuid"])
Пример #3
0
    def validate(self, task, deploy_id=None):
        """Validate a task file.

        :param task: a file with yaml/json configration
        :param deploy_id: a UUID of a deployment
        """

        task = os.path.expanduser(task)
        with open(task, "rb") as task_file:
            config_dict = yaml.safe_load(task_file.read())
        try:
            api.task_validate(deploy_id, config_dict)
            print("Task config is valid :)")
        except exceptions.InvalidTaskException as e:
            print("Task config is invalid: \n")
            print(e)
Пример #4
0
    def validate(self, task, deploy_id=None):
        """Validate a task configuration file.

        This will check that task configuration file has valid syntax and
        all required options of scenarios, contexts, SLA and runners are set.

        :param task: a file with yaml/json configration
        :param deploy_id: a UUID of a deployment
        """

        task = os.path.expanduser(task)
        with open(task, "rb") as task_file:
            config_dict = yaml.safe_load(task_file.read())
        try:
            api.task_validate(deploy_id, config_dict)
            print("Task config is valid :)")
        except exceptions.InvalidTaskException as e:
            print("Task config is invalid: \n")
            print(e)
Пример #5
0
    def validate(self, task, deploy_id=None):
        """Validate a task configuration file.

        This will check that task configuration file has valid syntax and
        all required options of scenarios, contexts, SLA and runners are set.

        :param task: a file with yaml/json configration
        :param deploy_id: a UUID of a deployment
        """

        task = os.path.expanduser(task)
        with open(task, "rb") as task_file:
            config_dict = yaml.safe_load(task_file.read())
        try:
            api.task_validate(deploy_id, config_dict)
            print("Task config is valid :)")
        except exceptions.InvalidTaskException as e:
            print("Task config is invalid: \n")
            print(e)