# Path: mistralclient/api/v2/environments.py
# class Environment(base.Resource):
# class EnvironmentManager(base.ResourceManager):
#     def _set_attributes(self):
#     def create(self, **kwargs):
#     def update(self, **kwargs):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', **filters):
#     def get(self, name):
#     def delete(self, name):
# 
# Path: mistralclient/commands/v2/environments.py
# class EnvironmentFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(command.ShowOne):
# class Delete(command.Command):
# class Update(command.ShowOne):
#     COLUMNS = [
#         ('name', 'Name'),
#         ('description', 'Description'),
#         ('variables', 'Variables'),
#         ('scope', 'Scope'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at'),
#     ]
#     LIST_COLUMN_FIELD_NAMES = [c[0] for c in COLUMNS if c[0] != 'variables']
#     LIST_COLUMN_HEADING_NAMES = [c[1] for c in COLUMNS if c[0] != 'variables']
#     def format(environment=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 take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     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=''):


import copy
import datetime
import os
import tempfile
import yaml
from unittest import mock
from oslo_serialization import jsonutils
from mistralclient.api.v2 import environments
from mistralclient.commands.v2 import environments as environment_cmd
from mistralclient.tests.unit import base
        'timeout': 600,
        'verbose': True
    },
    'created_at': str(datetime.datetime.utcnow()),
    'updated_at': str(datetime.datetime.utcnow())
}

ENVIRONMENT = environments.Environment(mock, ENVIRONMENT_DICT)
EXPECTED_RESULT = (ENVIRONMENT_DICT['name'],
                   ENVIRONMENT_DICT['description'],
                   jsonutils.dumps(ENVIRONMENT_DICT['variables'], indent=4),
                   ENVIRONMENT_DICT['scope'],
                   ENVIRONMENT_DICT['created_at'],
                   ENVIRONMENT_DICT['updated_at'])

EXPECTED_EXPORT_RESULT = (ENVIRONMENT_DICT['name'],
                          ENVIRONMENT_DICT['description'],
                          ENVIRONMENT_DICT['scope'],
                          jsonutils.dumps(ENVIRONMENT_DICT['variables']))


class TestCLIEnvironmentsV2(base.BaseCommandTest):

    def _test_create(self, content):
        self.client.environments.create.return_value = ENVIRONMENT

        with tempfile.NamedTemporaryFile() as f:
            f.write(content.encode('utf-8'))
            f.flush()
            file_path = os.path.abspath(f.name)

# Path: mistralclient/api/v2/environments.py
# class Environment(base.Resource):
# class EnvironmentManager(base.ResourceManager):
#     def _set_attributes(self):
#     def create(self, **kwargs):
#     def update(self, **kwargs):
#     def list(self, marker='', limit=None, sort_keys='', sort_dirs='',
#              fields='', **filters):
#     def get(self, name):
#     def delete(self, name):
# 
# Path: mistralclient/commands/v2/environments.py
# class EnvironmentFormatter(base.MistralFormatter):
# class List(base.MistralLister):
# class Get(command.ShowOne):
# class Create(command.ShowOne):
# class Delete(command.Command):
# class Update(command.ShowOne):
#     COLUMNS = [
#         ('name', 'Name'),
#         ('description', 'Description'),
#         ('variables', 'Variables'),
#         ('scope', 'Scope'),
#         ('created_at', 'Created at'),
#         ('updated_at', 'Updated at'),
#     ]
#     LIST_COLUMN_FIELD_NAMES = [c[0] for c in COLUMNS if c[0] != 'variables']
#     LIST_COLUMN_HEADING_NAMES = [c[1] for c in COLUMNS if c[0] != 'variables']
#     def format(environment=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 take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     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_environments.py
import copy
import datetime
import os
import tempfile
import yaml
from unittest import mock
from oslo_serialization import jsonutils
from mistralclient.api.v2 import environments
from mistralclient.commands.v2 import environments as environment_cmd
from mistralclient.tests.unit import base

        'timeout': 600,
        'verbose': True
    },
    'created_at': str(datetime.datetime.utcnow()),
    'updated_at': str(datetime.datetime.utcnow())
}

ENVIRONMENT = environments.Environment(mock, ENVIRONMENT_DICT)
EXPECTED_RESULT = (ENVIRONMENT_DICT['name'],
                   ENVIRONMENT_DICT['description'],
                   jsonutils.dumps(ENVIRONMENT_DICT['variables'], indent=4),
                   ENVIRONMENT_DICT['scope'],
                   ENVIRONMENT_DICT['created_at'],
                   ENVIRONMENT_DICT['updated_at'])

EXPECTED_EXPORT_RESULT = (ENVIRONMENT_DICT['name'],
                          ENVIRONMENT_DICT['description'],
                          ENVIRONMENT_DICT['scope'],
                          jsonutils.dumps(ENVIRONMENT_DICT['variables']))


class TestCLIEnvironmentsV2(base.BaseCommandTest):

    def _test_create(self, content):
        self.client.environments.create.return_value = ENVIRONMENT

        with tempfile.NamedTemporaryFile() as f:
            f.write(content.encode('utf-8'))
            f.flush()
            file_path = os.path.abspath(f.name)

            result = self.call(environment_cmd.Create, app_args=[file_path])