# Path: magnumclient/exceptions.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: magnumclient/tests/v1/shell_test_base.py
# FAKE_ENV = {'OS_USERNAME': 'username',
#             'OS_PASSWORD': 'password',
#             'OS_PROJECT_NAME': 'project_name',
#             'OS_AUTH_URL': 'http://no.where/v2.0',
#             'BYPASS_URL': 'http://magnum'}
# class TestCommandLineArgument(utils.TestCase):
#     def setUp(self):
#     def _test_arg_success(self, command, keyword=None):
#     def _test_arg_failure(self, command, error_msg):
# 
# Path: magnumclient/tests/v1/test_baymodels_shell.py
# class FakeBayModel(BayModel):
# class ShellTest(shell_test_base.TestCommandLineArgument):
#     def __init__(self, manager=None, info={}, **kwargs):
#     def _get_expected_args_list(self, limit=None, sort_dir=None,
#                                 sort_key=None, detail=False):
#     def _get_expected_args(self, image_id, external_network_id, coe,
#                            master_flavor_id=None, name=None,
#                            keypair_id=None, fixed_network=None,
#                            fixed_subnet=None, network_driver=None,
#                            volume_driver=None, dns_nameserver='8.8.8.8',
#                            flavor_id='m1.medium',
#                            docker_storage_driver='devicemapper',
#                            docker_volume_size=None, http_proxy=None,
#                            https_proxy=None, no_proxy=None, labels={},
#                            tls_disabled=False, public=False,
#                            master_lb_enabled=False, server_type='vm',
#                            registry_enabled=False, floating_ip_enabled=None):
#     def test_baymodel_create_success(self, mock_create):
#     def test_baymodel_create_success_no_servertype(self, mock_create):
#     def test_baymodel_create_success_with_registry_enabled(
#         self, mock_create):
#     def test_baymodel_create_public_success(self, mock_create):
#     def test_baymodel_create_success_with_master_flavor(self, mock_create):
#     def test_baymodel_create_docker_vol_size_success(self, mock_create):
#     def test_baymodel_create_docker_storage_driver_success(self, mock_create):
#     def test_baymodel_create_fixed_network_success(self, mock_create):
#     def test_baymodel_create_network_driver_success(self, mock_create):
#     def test_baymodel_create_volume_driver_success(self, mock_create):
#     def test_baymodel_create_http_proxy_success(self, mock_create):
#     def test_baymodel_create_https_proxy_success(self, mock_create):
#     def test_baymodel_create_no_proxy_success(self, mock_create):
#     def test_baymodel_create_labels_success(self, mock_create):
#     def test_baymodel_create_separate_labels_success(self, mock_create):
#     def test_baymodel_create_combined_labels_success(self, mock_create):
#     def test_baymodel_create_failure_few_arg(self, mock_create):
#     def test_baymodel_show_success(self, mock_show):
#     def test_baymodel_show_failure_no_arg(self, mock_show):
#     def test_baymodel_delete_success(self, mock_delete):
#     def test_baymodel_delete_multiple_id_success(self, mock_delete):
#     def test_baymodel_delete_failure_no_arg(self, mock_delete):
#     def test_baymodel_update_success(self, mock_update):
#     def test_baymodel_update_success_many_attribute(self, mock_update):
#     def test_baymodel_update_failure_wrong_op(self, mock_update):
#     def test_baymodel_update_failure_few_args(self, mock_update):
#     def test_baymodel_list_success(self, mock_list):
#     def test_baymodel_list_success_with_arg(self, mock_list):
#     def test_baymodel_list_success_detailed(self, mock_list):
#     def test_baymodel_list_ignored_duplicated_field(self, mock_list):
#     def test_baymodel_list_failure_with_invalid_field(self, mock_list):
#     def test_baymodel_list_failure_invalid_arg(self, mock_list):
#     def test_baymodel_list_failure(self, mock_list):
# 
# Path: magnumclient/v1/bays.py
# class Bay(baseunit.BaseTemplate):
#     template_name = "Bays"


from unittest import mock
from magnumclient import exceptions
from magnumclient.tests.v1 import shell_test_base
from magnumclient.tests.v1 import test_baymodels_shell
from magnumclient.v1.bays import Bay
        self._test_arg_success('bay-list '
                               '--marker some_uuid '
                               '--limit 1 '
                               '--sort-dir asc '
                               '--sort-key uuid')
        expected_args = self._get_expected_args_list('some_uuid', 1,
                                                     'asc', 'uuid')
        mock_list.assert_called_once_with(**expected_args)

    @mock.patch('magnumclient.v1.bays.BayManager.list')
    def test_bay_list_ignored_duplicated_field(self, mock_list):
        mock_list.return_value = [FakeBay()]
        self._test_arg_success('bay-list --fields status,status,status,name',
                               keyword=('\n| uuid | name | node_count | '
                                        'master_count | status |\n'))
        # Output should be
        # +------+------+------------+--------------+--------+
        # | uuid | name | node_count | master_count | status |
        # +------+------+------------+--------------+--------+
        # | x    | x    | x          | x            | x      |
        # +------+------+------------+--------------+--------+
        expected_args = self._get_expected_args_list()
        mock_list.assert_called_once_with(**expected_args)

    @mock.patch('magnumclient.v1.bays.BayManager.list')
    def test_bay_list_failure_with_invalid_field(self, mock_list):
        mock_list.return_value = [FakeBay()]
        _error_msg = [".*?^Non-existent fields are specified: ['xxx','zzz']"]
        self.assertRaises(exceptions.CommandError,
                          self._test_arg_failure,

# Path: magnumclient/exceptions.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: magnumclient/tests/v1/shell_test_base.py
# FAKE_ENV = {'OS_USERNAME': 'username',
#             'OS_PASSWORD': 'password',
#             'OS_PROJECT_NAME': 'project_name',
#             'OS_AUTH_URL': 'http://no.where/v2.0',
#             'BYPASS_URL': 'http://magnum'}
# class TestCommandLineArgument(utils.TestCase):
#     def setUp(self):
#     def _test_arg_success(self, command, keyword=None):
#     def _test_arg_failure(self, command, error_msg):
# 
# Path: magnumclient/tests/v1/test_baymodels_shell.py
# class FakeBayModel(BayModel):
# class ShellTest(shell_test_base.TestCommandLineArgument):
#     def __init__(self, manager=None, info={}, **kwargs):
#     def _get_expected_args_list(self, limit=None, sort_dir=None,
#                                 sort_key=None, detail=False):
#     def _get_expected_args(self, image_id, external_network_id, coe,
#                            master_flavor_id=None, name=None,
#                            keypair_id=None, fixed_network=None,
#                            fixed_subnet=None, network_driver=None,
#                            volume_driver=None, dns_nameserver='8.8.8.8',
#                            flavor_id='m1.medium',
#                            docker_storage_driver='devicemapper',
#                            docker_volume_size=None, http_proxy=None,
#                            https_proxy=None, no_proxy=None, labels={},
#                            tls_disabled=False, public=False,
#                            master_lb_enabled=False, server_type='vm',
#                            registry_enabled=False, floating_ip_enabled=None):
#     def test_baymodel_create_success(self, mock_create):
#     def test_baymodel_create_success_no_servertype(self, mock_create):
#     def test_baymodel_create_success_with_registry_enabled(
#         self, mock_create):
#     def test_baymodel_create_public_success(self, mock_create):
#     def test_baymodel_create_success_with_master_flavor(self, mock_create):
#     def test_baymodel_create_docker_vol_size_success(self, mock_create):
#     def test_baymodel_create_docker_storage_driver_success(self, mock_create):
#     def test_baymodel_create_fixed_network_success(self, mock_create):
#     def test_baymodel_create_network_driver_success(self, mock_create):
#     def test_baymodel_create_volume_driver_success(self, mock_create):
#     def test_baymodel_create_http_proxy_success(self, mock_create):
#     def test_baymodel_create_https_proxy_success(self, mock_create):
#     def test_baymodel_create_no_proxy_success(self, mock_create):
#     def test_baymodel_create_labels_success(self, mock_create):
#     def test_baymodel_create_separate_labels_success(self, mock_create):
#     def test_baymodel_create_combined_labels_success(self, mock_create):
#     def test_baymodel_create_failure_few_arg(self, mock_create):
#     def test_baymodel_show_success(self, mock_show):
#     def test_baymodel_show_failure_no_arg(self, mock_show):
#     def test_baymodel_delete_success(self, mock_delete):
#     def test_baymodel_delete_multiple_id_success(self, mock_delete):
#     def test_baymodel_delete_failure_no_arg(self, mock_delete):
#     def test_baymodel_update_success(self, mock_update):
#     def test_baymodel_update_success_many_attribute(self, mock_update):
#     def test_baymodel_update_failure_wrong_op(self, mock_update):
#     def test_baymodel_update_failure_few_args(self, mock_update):
#     def test_baymodel_list_success(self, mock_list):
#     def test_baymodel_list_success_with_arg(self, mock_list):
#     def test_baymodel_list_success_detailed(self, mock_list):
#     def test_baymodel_list_ignored_duplicated_field(self, mock_list):
#     def test_baymodel_list_failure_with_invalid_field(self, mock_list):
#     def test_baymodel_list_failure_invalid_arg(self, mock_list):
#     def test_baymodel_list_failure(self, mock_list):
# 
# Path: magnumclient/v1/bays.py
# class Bay(baseunit.BaseTemplate):
#     template_name = "Bays"


# Path: magnumclient/tests/v1/test_bays_shell.py
from unittest import mock
from magnumclient import exceptions
from magnumclient.tests.v1 import shell_test_base
from magnumclient.tests.v1 import test_baymodels_shell
from magnumclient.v1.bays import Bay

        self._test_arg_success('bay-list '
                               '--marker some_uuid '
                               '--limit 1 '
                               '--sort-dir asc '
                               '--sort-key uuid')
        expected_args = self._get_expected_args_list('some_uuid', 1,
                                                     'asc', 'uuid')
        mock_list.assert_called_once_with(**expected_args)

    @mock.patch('magnumclient.v1.bays.BayManager.list')
    def test_bay_list_ignored_duplicated_field(self, mock_list):
        mock_list.return_value = [FakeBay()]
        self._test_arg_success('bay-list --fields status,status,status,name',
                               keyword=('\n| uuid | name | node_count | '
                                        'master_count | status |\n'))
        # Output should be
        # +------+------+------------+--------------+--------+
        # | uuid | name | node_count | master_count | status |
        # +------+------+------------+--------------+--------+
        # | x    | x    | x          | x            | x      |
        # +------+------+------------+--------------+--------+
        expected_args = self._get_expected_args_list()
        mock_list.assert_called_once_with(**expected_args)

    @mock.patch('magnumclient.v1.bays.BayManager.list')
    def test_bay_list_failure_with_invalid_field(self, mock_list):
        mock_list.return_value = [FakeBay()]
        _error_msg = [".*?^Non-existent fields are specified: ['xxx','zzz']"]
        self.assertRaises(exceptions.CommandError,
                          self._test_arg_failure,

                          'bay-list --fields xxx,stack_id,zzz,status',