# Path: mistralclient/api/v2/event_triggers.py
# class EventTrigger(base.Resource):
# class EventTriggerManager(base.ResourceManager):
#     def create(self, name, workflow_id, exchange, topic, event,
#                workflow_input=None, workflow_params=None):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', **filters):
#     def get(self, id):
#     def delete(self, id):
# 
# Path: mistralclient/commands/v2/event_triggers.py
# class EventTriggerFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(command.ShowOne):
# class Delete(command.Command):
#     COLUMNS = [
#         ('id', 'ID'),
#         ('name', 'Name'),
#         ('workflow_id', 'Workflow ID'),
#         ('workflow_params', 'Params'),
#         ('exchange', 'Exchange'),
#         ('topic', 'Topic'),
#         ('event', 'Event'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at')
#     ]
#     def format(trigger=None, lister=False):
#     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_json_string_or_dict(string):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# 
# 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 event_triggers
from mistralclient.commands.v2 import event_triggers as event_triggers_cmd
from mistralclient.tests.unit import base
#    under the License.
#




TRIGGER_DICT = {
    'id': '456',
    'name': 'my_trigger',
    'workflow_id': '123e4567-e89b-12d3-a456-426655440000',
    'workflow_input': {},
    'workflow_params': {},
    'exchange': 'dummy_exchange',
    'topic': 'dummy_topic',
    'event': 'event.dummy',
    'created_at': '1',
    'updated_at': '1'
}

TRIGGER = event_triggers.EventTrigger(mock, TRIGGER_DICT)


class TestCLITriggersV2(base.BaseCommandTest):

    @mock.patch('argparse.open', create=True)
    def test_create(self, mock_open):
        self.client.event_triggers.create.return_value = TRIGGER
        mock_open.return_value = mock.MagicMock(spec=open)

        result = self.call(

# Path: mistralclient/api/v2/event_triggers.py
# class EventTrigger(base.Resource):
# class EventTriggerManager(base.ResourceManager):
#     def create(self, name, workflow_id, exchange, topic, event,
#                workflow_input=None, workflow_params=None):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', **filters):
#     def get(self, id):
#     def delete(self, id):
# 
# Path: mistralclient/commands/v2/event_triggers.py
# class EventTriggerFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(command.ShowOne):
# class Delete(command.Command):
#     COLUMNS = [
#         ('id', 'ID'),
#         ('name', 'Name'),
#         ('workflow_id', 'Workflow ID'),
#         ('workflow_params', 'Params'),
#         ('exchange', 'Exchange'),
#         ('topic', 'Topic'),
#         ('event', 'Event'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at')
#     ]
#     def format(trigger=None, lister=False):
#     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_json_string_or_dict(string):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def take_action(self, parsed_args):
# 
# 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_event_triggers.py
from unittest import mock
from mistralclient.api.v2 import event_triggers
from mistralclient.commands.v2 import event_triggers as event_triggers_cmd
from mistralclient.tests.unit import base

#    under the License.
#




TRIGGER_DICT = {
    'id': '456',
    'name': 'my_trigger',
    'workflow_id': '123e4567-e89b-12d3-a456-426655440000',
    'workflow_input': {},
    'workflow_params': {},
    'exchange': 'dummy_exchange',
    'topic': 'dummy_topic',
    'event': 'event.dummy',
    'created_at': '1',
    'updated_at': '1'
}

TRIGGER = event_triggers.EventTrigger(mock, TRIGGER_DICT)


class TestCLITriggersV2(base.BaseCommandTest):

    @mock.patch('argparse.open', create=True)
    def test_create(self, mock_open):
        self.client.event_triggers.create.return_value = TRIGGER
        mock_open.return_value = mock.MagicMock(spec=open)

        result = self.call(

            event_triggers_cmd.Create,