# Path: mistralclient/api/v2/workflows.py
# class Workflow(base.Resource):
# class WorkflowManager(base.ResourceManager):
#     def create(self, definition, namespace='', scope='private'):
#     def update(self, definition, namespace='', scope='private', id=None):
#     def list(self, namespace='', marker='', limit=None, sort_keys='',
#              sort_dirs='', fields='', **filters):
#     def get(self, identifier, namespace=''):
#     def delete(self, identifier, namespace=None):
#     def validate(self, definition):
# 
# Path: mistralclient/tests/unit/v2/base.py
# class BaseClientV2Test(base.BaseClientTest):
#     TEST_URL = 'http://mistral.example.com'
#     def setUp(self):


import os.path
import pkg_resources as pkg
from urllib import parse
from urllib import request
from mistralclient.api.v2 import workflows
from mistralclient.tests.unit.v2 import base
version: 2.0

my_wf:
  type: direct

  tasks:
    task1:
      action: std.echo output="hello, world"
"""

WORKFLOW = {
    'id': '123',
    'name': 'my_wf',
    'input': '',
    'definition': WF_DEF
}

URL_TEMPLATE = '/workflows'
URL_TEMPLATE_SCOPE = '/workflows?scope=private'
URL_TEMPLATE_NAME = '/workflows/%s'


class TestWorkflowsV2(base.BaseClientV2Test):
    def test_create(self):
        self.requests_mock.post(
            self.TEST_URL + URL_TEMPLATE_SCOPE,
            json={'workflows': [WORKFLOW]},
            status_code=201
        )


# Path: mistralclient/api/v2/workflows.py
# class Workflow(base.Resource):
# class WorkflowManager(base.ResourceManager):
#     def create(self, definition, namespace='', scope='private'):
#     def update(self, definition, namespace='', scope='private', id=None):
#     def list(self, namespace='', marker='', limit=None, sort_keys='',
#              sort_dirs='', fields='', **filters):
#     def get(self, identifier, namespace=''):
#     def delete(self, identifier, namespace=None):
#     def validate(self, definition):
# 
# Path: mistralclient/tests/unit/v2/base.py
# class BaseClientV2Test(base.BaseClientTest):
#     TEST_URL = 'http://mistral.example.com'
#     def setUp(self):


# Path: mistralclient/tests/unit/v2/test_workflows.py
import os.path
import pkg_resources as pkg
from urllib import parse
from urllib import request
from mistralclient.api.v2 import workflows
from mistralclient.tests.unit.v2 import base

version: 2.0

my_wf:
  type: direct

  tasks:
    task1:
      action: std.echo output="hello, world"
"""

WORKFLOW = {
    'id': '123',
    'name': 'my_wf',
    'input': '',
    'definition': WF_DEF
}

URL_TEMPLATE = '/workflows'
URL_TEMPLATE_SCOPE = '/workflows?scope=private'
URL_TEMPLATE_NAME = '/workflows/%s'


class TestWorkflowsV2(base.BaseClientV2Test):
    def test_create(self):
        self.requests_mock.post(
            self.TEST_URL + URL_TEMPLATE_SCOPE,
            json={'workflows': [WORKFLOW]},
            status_code=201
        )


        wfs = self.workflows.create(WF_DEF)