# Path: mistralclient/api/v2/actions.py
# class Action(base.Resource):
# class ActionManager(base.ResourceManager):
#     def create(self, definition, scope='private', namespace=''):
#     def update(self, definition, scope='private', id=None, namespace=''):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', namespace='', **filters):
#     def get(self, identifier, namespace=''):
#     def delete(self, identifier, namespace=''):
#     def validate(self, definition):
# 
# Path: mistralclient/commands/v2/actions.py
# class ActionFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(base.MistralLister):
# class Delete(command.Command):
# class Update(base.MistralLister):
# class GetDefinition(command.Command):
# class Validate(command.ShowOne):
#     COLUMNS = [
#         ('id', 'ID'),
#         ('name', 'Name'),
#         ('is_system', 'Is system'),
#         ('input', 'Input'),
#         ('description', 'Description'),
#         ('tags', 'Tags'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at'),
#     ]
#     def format(action=None, lister=False):
#     def _get_format_function(self):
#     def get_parser(self, prog_name):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _validate_parsed_args(self, parsed_args):
#     def _get_format_function(self):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _get_format_function(self):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def _format(result=None):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# 
# Path: mistralclient/commands/v2/base.py
# DEFAULT_LIMIT = 100
#     COLUMNS = []
# class MistralFormatter(metaclass=abc.ABCMeta):
# class MistralLister(command.Lister, metaclass=abc.ABCMeta):
# class MistralExecutionLister(MistralLister, metaclass=abc.ABCMeta):
#     def fields(cls):
#     def headings(cls):
#     def format_list(cls, instance=None):
#     def format(instance=None, lister=False):
#     def _get_format_function(self):
#     def get_parser(self, parsed_args):
#     def _get_resources(self, parsed_args):
#     def _validate_parsed_args(self, parsed_args):
#     def take_action(self, parsed_args):
#     def get_parser(self, parsed_args):
#     def take_action(self, parsed_args):
# def cut(string, length=25):
# def wrap(string, width=25):
# def get_filters(parsed_args):
# def get_duration_str(start_dt_str, end_dt_str):
# 
# Path: mistralclient/tests/unit/base.py
# class BaseClientTest(base.BaseTestCase):
# class BaseCommandTest(base.BaseTestCase):
#     def setUp(self):
#     def setUp(self):
#     def call(self, command, app_args=(), prog_name=''):


from unittest import mock
from mistralclient.api.v2 import actions
from mistralclient.commands.v2 import actions as action_cmd
from mistralclient.commands.v2 import base as cmd_base
from mistralclient.tests.unit import base
    'is_system': True,
    'input': "param1",
    'description': 'My cool action',
    'tags': ['test'],
    'created_at': '1',
    'updated_at': '1',
    'namespace': 'test_namespace'
}

ACTION_DEF = """
---
version: '2.0'

base: std.echo
base-parameters:
    output: "<% $.str1 %><% $.str2 %>"
output: "<% $ %><% $ %>"
"""

ACTION_WITH_DEF_DICT = ACTION_DICT.copy()
ACTION_WITH_DEF_DICT.update({'definition': ACTION_DEF})
ACTION = actions.Action(mock, ACTION_DICT)
ACTION_WITH_DEF = actions.Action(mock, ACTION_WITH_DEF_DICT)


class TestCLIActionsV2(base.BaseCommandTest):
    @mock.patch('argparse.open', create=True)
    def test_create(self, mock_open):
        self.client.actions.create.return_value = [ACTION]


# Path: mistralclient/api/v2/actions.py
# class Action(base.Resource):
# class ActionManager(base.ResourceManager):
#     def create(self, definition, scope='private', namespace=''):
#     def update(self, definition, scope='private', id=None, namespace=''):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', namespace='', **filters):
#     def get(self, identifier, namespace=''):
#     def delete(self, identifier, namespace=''):
#     def validate(self, definition):
# 
# Path: mistralclient/commands/v2/actions.py
# class ActionFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(base.MistralLister):
# class Delete(command.Command):
# class Update(base.MistralLister):
# class GetDefinition(command.Command):
# class Validate(command.ShowOne):
#     COLUMNS = [
#         ('id', 'ID'),
#         ('name', 'Name'),
#         ('is_system', 'Is system'),
#         ('input', 'Input'),
#         ('description', 'Description'),
#         ('tags', 'Tags'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at'),
#     ]
#     def format(action=None, lister=False):
#     def _get_format_function(self):
#     def get_parser(self, prog_name):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _validate_parsed_args(self, parsed_args):
#     def _get_format_function(self):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _get_format_function(self):
#     def _get_resources(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
#     def _format(result=None):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# 
# Path: mistralclient/commands/v2/base.py
# DEFAULT_LIMIT = 100
#     COLUMNS = []
# class MistralFormatter(metaclass=abc.ABCMeta):
# class MistralLister(command.Lister, metaclass=abc.ABCMeta):
# class MistralExecutionLister(MistralLister, metaclass=abc.ABCMeta):
#     def fields(cls):
#     def headings(cls):
#     def format_list(cls, instance=None):
#     def format(instance=None, lister=False):
#     def _get_format_function(self):
#     def get_parser(self, parsed_args):
#     def _get_resources(self, parsed_args):
#     def _validate_parsed_args(self, parsed_args):
#     def take_action(self, parsed_args):
#     def get_parser(self, parsed_args):
#     def take_action(self, parsed_args):
# def cut(string, length=25):
# def wrap(string, width=25):
# def get_filters(parsed_args):
# def get_duration_str(start_dt_str, end_dt_str):
# 
# Path: mistralclient/tests/unit/base.py
# class BaseClientTest(base.BaseTestCase):
# class BaseCommandTest(base.BaseTestCase):
#     def setUp(self):
#     def setUp(self):
#     def call(self, command, app_args=(), prog_name=''):


# Path: mistralclient/tests/unit/v2/test_cli_actions.py
from unittest import mock
from mistralclient.api.v2 import actions
from mistralclient.commands.v2 import actions as action_cmd
from mistralclient.commands.v2 import base as cmd_base
from mistralclient.tests.unit import base

    'is_system': True,
    'input': "param1",
    'description': 'My cool action',
    'tags': ['test'],
    'created_at': '1',
    'updated_at': '1',
    'namespace': 'test_namespace'
}

ACTION_DEF = """
---
version: '2.0'

base: std.echo
base-parameters:
    output: "<% $.str1 %><% $.str2 %>"
output: "<% $ %><% $ %>"
"""

ACTION_WITH_DEF_DICT = ACTION_DICT.copy()
ACTION_WITH_DEF_DICT.update({'definition': ACTION_DEF})
ACTION = actions.Action(mock, ACTION_DICT)
ACTION_WITH_DEF = actions.Action(mock, ACTION_WITH_DEF_DICT)


class TestCLIActionsV2(base.BaseCommandTest):
    @mock.patch('argparse.open', create=True)
    def test_create(self, mock_open):
        self.client.actions.create.return_value = [ACTION]


        result = self.call(action_cmd.Create, app_args=['1.txt'])