# 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/v1/mservices.py
# class MService(base.Resource):
# class MServiceManager(base.Manager):
#     def __repr__(self):
#     def _path(id=None):
#     def list(self, marker=None, limit=None, sort_key=None,
#              sort_dir=None, detail=False):


import testtools
from testtools import matchers
from magnumclient.tests import utils
from magnumclient.v1 import mservices
    '/v1/mservices/?sort_key=id':
    {
        'GET': (
            {},
            {'mservices': [SERVICE1, SERVICE2]},
        ),
    },
    '/v1/mservices/?sort_key=id&sort_dir=desc':
    {
        'GET': (
            {},
            {'mservices': [SERVICE2, SERVICE1]},
        ),
    },
}


class MServiceManagerTest(testtools.TestCase):

    def setUp(self):
        super(MServiceManagerTest, self).setUp()
        self.api = utils.FakeAPI(fake_responses)
        self.mgr = mservices.MServiceManager(self.api)

    def test_coe_service_list(self):
        mservices = self.mgr.list()
        expect = [
            ('GET', '/v1/mservices', {}, None),
        ]
        self.assertEqual(expect, self.api.calls)

# 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/v1/mservices.py
# class MService(base.Resource):
# class MServiceManager(base.Manager):
#     def __repr__(self):
#     def _path(id=None):
#     def list(self, marker=None, limit=None, sort_key=None,
#              sort_dir=None, detail=False):


# Path: magnumclient/tests/v1/test_mservices.py
import testtools
from testtools import matchers
from magnumclient.tests import utils
from magnumclient.v1 import mservices

    '/v1/mservices/?sort_key=id':
    {
        'GET': (
            {},
            {'mservices': [SERVICE1, SERVICE2]},
        ),
    },
    '/v1/mservices/?sort_key=id&sort_dir=desc':
    {
        'GET': (
            {},
            {'mservices': [SERVICE2, SERVICE1]},
        ),
    },
}


class MServiceManagerTest(testtools.TestCase):

    def setUp(self):
        super(MServiceManagerTest, self).setUp()
        self.api = utils.FakeAPI(fake_responses)
        self.mgr = mservices.MServiceManager(self.api)

    def test_coe_service_list(self):
        mservices = self.mgr.list()
        expect = [
            ('GET', '/v1/mservices', {}, None),
        ]
        self.assertEqual(expect, self.api.calls)

        self.assertThat(mservices, matchers.HasLength(2))