# 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/utils.py
# FAKE_ENV = {'OS_USERNAME': 'username',
#             'OS_PASSWORD': 'password',
#             'OS_PROJECT_NAME': 'project_name',
#             'OS_AUTH_URL': 'http://no.where/v2.0'}
#     TEST_REQUEST_BASE = {
#         'verify': True,
#     }
# class BaseTestCase(testtools.TestCase):
# class FakeAPI(object):
# class FakeConnection(object):
# class FakeResponse(object):
# class FakeServiceCatalog(object):
# class FakeKeystone(object):
# class TestCase(testtools.TestCase):
# class FakeSessionResponse(object):
# class FakeSession(object):
#     def setUp(self):
#     def __init__(self, responses):
#     def _request(self, method, url, headers=None, body=None):
#     def raw_request(self, *args, **kwargs):
#     def json_request(self, *args, **kwargs):
#     def __init__(self, response=None, **kwargs):
#     def request(self, method, conn_url, **kwargs):
#     def setresponse(self, response):
#     def getresponse(self):
#     def __init__(self, headers, body=None, version=None, status=None,
#                  reason=None):
#     def __getitem__(self, key):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def url_for(self, endpoint_type, service_type, attr=None,
#                 filter_value=None):
#     def __init__(self, auth_token):
#     def setUp(self):
#     def make_env(self, exclude=None, fake_env=FAKE_ENV):
#     def shell(self, argstr, exitcodes=(0,)):
#     def __init__(self, headers, content=None, status_code=None):
#     def json(self):
#     def __init__(self, headers, content=None, status_code=None):
#     def request(self, url, method, **kwargs):


import io
import re
import sys
import argparse
import fixtures
import magnumclient.shell
from unittest import mock
from keystoneauth1 import fixture
from testtools import matchers
from magnumclient import exceptions
from magnumclient.tests import utils
        self.assertIn('Command-line interface to the OpenStack Magnum API',
                      sys.stdout.getvalue())

    def _expected_client_kwargs(self):
        return {
            'password': 'password', 'auth_token': None,
            'auth_url': self.AUTH_URL, 'profile': None,
            'cloud': None, 'interface': 'public',
            'insecure': False, 'magnum_url': None,
            'project_id': None, 'project_name': 'project_name',
            'project_domain_id': None, 'project_domain_name': None,
            'region_name': None, 'service_type': 'container-infra',
            'user_id': None, 'username': 'username',
            'user_domain_id': None, 'user_domain_name': None,
            'api_version': 'latest'
        }

    @mock.patch('magnumclient.v1.client.Client')
    def _test_main_region(self, command, expected_region_name, mock_client):
        self.shell(command)
        expected_args = self._expected_client_kwargs()
        expected_args['region_name'] = expected_region_name
        mock_client.assert_called_once_with(**expected_args)

    def test_main_option_region(self):
        self.make_env()
        self._test_main_region('--os-region-name=myregion bay-list',
                               'myregion')

    def test_main_env_region(self):

# 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/utils.py
# FAKE_ENV = {'OS_USERNAME': 'username',
#             'OS_PASSWORD': 'password',
#             'OS_PROJECT_NAME': 'project_name',
#             'OS_AUTH_URL': 'http://no.where/v2.0'}
#     TEST_REQUEST_BASE = {
#         'verify': True,
#     }
# class BaseTestCase(testtools.TestCase):
# class FakeAPI(object):
# class FakeConnection(object):
# class FakeResponse(object):
# class FakeServiceCatalog(object):
# class FakeKeystone(object):
# class TestCase(testtools.TestCase):
# class FakeSessionResponse(object):
# class FakeSession(object):
#     def setUp(self):
#     def __init__(self, responses):
#     def _request(self, method, url, headers=None, body=None):
#     def raw_request(self, *args, **kwargs):
#     def json_request(self, *args, **kwargs):
#     def __init__(self, response=None, **kwargs):
#     def request(self, method, conn_url, **kwargs):
#     def setresponse(self, response):
#     def getresponse(self):
#     def __init__(self, headers, body=None, version=None, status=None,
#                  reason=None):
#     def __getitem__(self, key):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def url_for(self, endpoint_type, service_type, attr=None,
#                 filter_value=None):
#     def __init__(self, auth_token):
#     def setUp(self):
#     def make_env(self, exclude=None, fake_env=FAKE_ENV):
#     def shell(self, argstr, exitcodes=(0,)):
#     def __init__(self, headers, content=None, status_code=None):
#     def json(self):
#     def __init__(self, headers, content=None, status_code=None):
#     def request(self, url, method, **kwargs):


# Path: magnumclient/tests/test_shell.py
import io
import re
import sys
import argparse
import fixtures
import magnumclient.shell
from unittest import mock
from keystoneauth1 import fixture
from testtools import matchers
from magnumclient import exceptions
from magnumclient.tests import utils

        self.assertIn('Command-line interface to the OpenStack Magnum API',
                      sys.stdout.getvalue())

    def _expected_client_kwargs(self):
        return {
            'password': 'password', 'auth_token': None,
            'auth_url': self.AUTH_URL, 'profile': None,
            'cloud': None, 'interface': 'public',
            'insecure': False, 'magnum_url': None,
            'project_id': None, 'project_name': 'project_name',
            'project_domain_id': None, 'project_domain_name': None,
            'region_name': None, 'service_type': 'container-infra',
            'user_id': None, 'username': 'username',
            'user_domain_id': None, 'user_domain_name': None,
            'api_version': 'latest'
        }

    @mock.patch('magnumclient.v1.client.Client')
    def _test_main_region(self, command, expected_region_name, mock_client):
        self.shell(command)
        expected_args = self._expected_client_kwargs()
        expected_args['region_name'] = expected_region_name
        mock_client.assert_called_once_with(**expected_args)

    def test_main_option_region(self):
        self.make_env()
        self._test_main_region('--os-region-name=myregion bay-list',
                               'myregion')

    def test_main_env_region(self):

        fake_env = dict(utils.FAKE_ENV, OS_REGION_NAME='myregion')