diff --git a/functionaltests/hello.yaml b/functionaltests/resources/v1/wb_v1.yaml similarity index 97% rename from functionaltests/hello.yaml rename to functionaltests/resources/v1/wb_v1.yaml index f3f27660..e51404ba 100644 --- a/functionaltests/hello.yaml +++ b/functionaltests/resources/v1/wb_v1.yaml @@ -1,3 +1,4 @@ +--- Namespaces: Greetings: actions: diff --git a/functionaltests/hello2.yaml b/functionaltests/resources/v2/wb_v2.yaml similarity index 83% rename from functionaltests/hello2.yaml rename to functionaltests/resources/v2/wb_v2.yaml index ad4362d8..de2c65ca 100644 --- a/functionaltests/hello2.yaml +++ b/functionaltests/resources/v2/wb_v2.yaml @@ -1,6 +1,7 @@ -Version: '2.0' +--- +version: '2.0' -Workflows: +workflows: wf1: type: direct start-task: hello diff --git a/functionaltests/resources/v2/wf_v2.yaml b/functionaltests/resources/v2/wf_v2.yaml new file mode 100644 index 00000000..68645daf --- /dev/null +++ b/functionaltests/resources/v2/wf_v2.yaml @@ -0,0 +1,10 @@ +--- +version: '2.0' + +type: direct +start-task: hello +tasks: + hello: + action: std.echo output="Hello" + publish: + result: $ diff --git a/mistralclient/tests/functional/cli/v1/cli_tests.py b/mistralclient/tests/functional/cli/v1/cli_tests.py index 600d5466..386b1a5b 100644 --- a/mistralclient/tests/functional/cli/v1/cli_tests.py +++ b/mistralclient/tests/functional/cli/v1/cli_tests.py @@ -64,8 +64,8 @@ class ClientTestBase(MistralCLIAuth): def setUpClass(cls): super(ClientTestBase, cls).setUpClass() - cls.definition = os.path.relpath( - 'functionaltests/hello.yaml', os.getcwd()) + cls.wb_def = os.path.relpath( + 'functionaltests/resources/v1/wb_v1.yaml', os.getcwd()) def tearDown(self): super(ClientTestBase, self).tearDown() @@ -131,7 +131,7 @@ class WorkbookCLITests(ClientTestBase): self.parser.listing(self.mistral( 'workbook-upload-definition', - params='"wb" "{0}"'.format(self.definition))) + params='"wb" "{0}"'.format(self.wb_def))) definition = self.mistral('workbook-get-definition', params='wb') self.assertNotIn('404 Not Found', definition) @@ -145,7 +145,7 @@ class ExecutionCLITests(ClientTestBase): self.mistral('workbook-create', params='wb') self.mistral('workbook-upload-definition', - params='"wb" "{0}"'.format(self.definition)) + params='"wb" "{0}"'.format(self.wb_def)) def tearDown(self): super(ExecutionCLITests, self).tearDown() @@ -225,7 +225,7 @@ class TaskCLITests(ClientTestBase): def test_get_task(self): self.mistral('workbook-create', params='wb') self.mistral('workbook-upload-definition', - params='"wb" "{0}"'.format(self.definition)) + params='"wb" "{0}"'.format(self.wb_def)) execution = self.parser.listing(self.mistral( 'execution-create', params='"wb" "hello" "{}"')) @@ -332,7 +332,7 @@ class NegativeCLITests(ClientTestBase): def test_ex_update_set_wrong_state(self): self.mistral('workbook-create', params='wb') self.mistral('workbook-upload-definition', - params='"wb" "{0}"'.format(self.definition)) + params='"wb" "{0}"'.format(self.wb_def)) execution = self.parser.listing(self.mistral( 'execution-create', params='"wb" "hello" "{}"')) @@ -345,7 +345,7 @@ class NegativeCLITests(ClientTestBase): def test_task_get_nonexisting_task(self): self.mistral('workbook-create', params='wb') self.mistral('workbook-upload-definition', - params='"wb" "{0}"'.format(self.definition)) + params='"wb" "{0}"'.format(self.wb_def)) self.mistral('execution-create', params='"wb" "hello" "{}"') diff --git a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py index a7a70072..bc250aea 100644 --- a/mistralclient/tests/functional/cli/v2/cli_tests_v2.py +++ b/mistralclient/tests/functional/cli/v2/cli_tests_v2.py @@ -27,6 +27,7 @@ class MistralCLIAuth(cli.ClientTestBase): keystone_version=3): """Executes Mistral command.""" mistral_url_op = "--os-mistral-url %s" % MISTRAL_URL + return self.cmd_with_auth( 'mistral %s' % mistral_url_op, action, flags, params, admin, fail_ok, keystone_version) @@ -71,8 +72,11 @@ class ClientTestBase(MistralCLIAuth): def setUpClass(cls): super(ClientTestBase, cls).setUpClass() - cls.definition = os.path.relpath( - 'functionaltests/hello2.yaml', os.getcwd()) + cls.wb_def = os.path.relpath( + 'functionaltests/resources/v2/wb_v2.yaml', os.getcwd()) + + cls.wf_def = os.path.relpath( + 'functionaltests/resources/v2/wf_v2.yaml', os.getcwd()) def tearDown(self): super(ClientTestBase, self).tearDown() @@ -105,7 +109,7 @@ class WorkbookCLITests(ClientTestBase): def test_workbook_create_delete(self): wb1 = self.mistral_command( - 'workbook-create', params='wb wb_tag {0}'.format(self.definition)) + 'workbook-create', params='wb wb_tag {0}'.format(self.wb_def)) self.assertTableStruct(wb1, ['Field', 'Value']) wfs = self.mistral_command('workflow-list') @@ -161,7 +165,7 @@ class WorkbookCLITests(ClientTestBase): def test_workbook_upload_get_definition(self): self.mistral('workbook-create', params='wb') self.mistral('workbook-upload-definition', - params='wb {0}'.format(self.definition)) + params='wb {0}'.format(self.wb_def)) definition = self.mistral_command('workbook-get-definition', params='wb') @@ -177,7 +181,7 @@ class WorkflowCLITests(ClientTestBase): def test_workflow_create_delete(self): wf = self.mistral_command( - 'workflow-create', params='wf wf_tag {0}'.format(self.definition)) + 'workflow-create', params='wf wf_tag {0}'.format(self.wf_def)) self.assertTableStruct(wf, ['Field', 'Value']) name = self.get_value_of_field(wf, "Name") @@ -192,7 +196,7 @@ class WorkflowCLITests(ClientTestBase): def test_workflow_update(self): self.mistral( - 'workflow-create', params='wf wf_tag {0}'.format(self.definition)) + 'workflow-create', params='wf wf_tag {0}'.format(self.wf_def)) wf = self.mistral_command('workflow-update', params='wf tag') self.assertTableStruct(wf, ['Field', 'Value']) @@ -205,7 +209,7 @@ class WorkflowCLITests(ClientTestBase): def test_workflow_get(self): created = self.mistral_command( - 'workflow-create', params='wf wf_tag {0}'.format(self.definition)) + 'workflow-create', params='wf wf_tag {0}'.format(self.wf_def)) fetched = self.mistral_command('workflow-get', params='wf') @@ -221,10 +225,10 @@ class WorkflowCLITests(ClientTestBase): def test_workflow_upload_get_definition(self): self.mistral( - 'workflow-create', params='wf wf_tag {0}'.format(self.definition)) + 'workflow-create', params='wf wf_tag {0}'.format(self.wf_def)) self.mistral( 'workflow-upload-definition', - params='wf {0}'.format(self.definition)) + params='wf {0}'.format(self.wf_def)) definition = self.mistral_command( 'workflow-get-definition', params='wf') @@ -238,7 +242,7 @@ class ExecutionCLITests(ClientTestBase): super(ExecutionCLITests, self).setUp() self.mistral( - 'workbook-create', params='wb wb_tag {0}'.format(self.definition)) + 'workbook-create', params='wb wb_tag {0}'.format(self.wb_def)) def tearDown(self): super(ExecutionCLITests, self).tearDown() diff --git a/mistralclient/tests/functional/client/v1/base.py b/mistralclient/tests/functional/client/v1/base.py index f7bb37ad..bbfa4892 100644 --- a/mistralclient/tests/functional/client/v1/base.py +++ b/mistralclient/tests/functional/client/v1/base.py @@ -27,7 +27,8 @@ class MistralBase(testtools.TestCase): cls.mistral_client = ClientAuth(mgr.auth_provider).mistral_client cls.definition = open(os.path.relpath( - 'functionaltests/hello.yaml', os.getcwd()), 'rb').read() + 'functionaltests/resources/v1/wb_v1.yaml', + os.getcwd()), 'rb').read() cls.wb = cls.mistral_client.workbooks.create( "wb", "Description", ["tags"])