# Path: ironicclient/common/base.py
# def getid(obj):
#     def __init__(self, api):
#     def _path(self, resource_id=None):
#     def resource_class(self):
#     def _resource_name(self):
#     def _get(self, resource_id, fields=None, os_ironic_api_version=None,
#              global_request_id=None):
#     def _get_as_dict(self, resource_id, fields=None,
#                      os_ironic_api_version=None, global_request_id=None):
#     def _format_body_data(self, body, response_key):
#     def _list_pagination(self, url, response_key=None, obj_class=None,
#                          limit=None, os_ironic_api_version=None,
#                          global_request_id=None):
#     def __list(self, url, response_key=None, body=None,
#                os_ironic_api_version=None, global_request_id=None):
#     def _list(self, url, response_key=None, obj_class=None, body=None,
#               os_ironic_api_version=None, global_request_id=None):
#     def _list_primitives(self, url, response_key=None,
#                          os_ironic_api_version=None, global_request_id=None):
#     def _update(self, resource_id, patch, method='PATCH',
#                 os_ironic_api_version=None, global_request_id=None,
#                 params=None):
#     def _delete(self, resource_id,
#                 os_ironic_api_version=None, global_request_id=None):
#     def _creation_attributes(self):
#     def create(self, os_ironic_api_version=None, global_request_id=None,
#                **kwargs):
#     def to_dict(self):
# class Manager(object, metaclass=abc.ABCMeta):
# class CreateManager(Manager, metaclass=abc.ABCMeta):
# class Resource(base.Resource):
# 
# Path: ironicclient/exc.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# class StateTransitionFailed(exceptions.ClientException):
# class StateTransitionTimeout(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: ironicclient/tests/unit/utils.py
# class BaseTestCase(testtools.TestCase):
# class FakeAPI(object):
# class FakeConnection(object):
# class FakeResponse(object):
#     def setUp(self):
#     def __init__(self, responses, path_prefix=None):
#     def _request(self, method, url, headers=None, body=None, params=None):
#     def raw_request(self, *args, **kwargs):
#     def json_request(self, *args, **kwargs):
#     def __init__(self, response=None, path_prefix=None):
#     def request(self, method, conn_url, **kwargs):
#     def setresponse(self, response):
#     def getresponse(self):
#     def __repr__(self):
#     def __init__(self, headers, body=None, version=None, status=None,
#                  reason=None, request_headers={}):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def __repr__(self):
# def mockSessionResponse(headers, content=None, status_code=None, version=None,
#                         request_headers={}):
# def mockSession(headers, content=None, status_code=None, version=None):


import copy
import testtools
from unittest import mock
from ironicclient.common import base
from ironicclient import exc
from ironicclient.tests.unit import utils
class ManagerTestCase(testtools.TestCase):

    def setUp(self):
        super(ManagerTestCase, self).setUp()
        self.api = utils.FakeAPI(fake_responses)
        self.manager = TestableManager(self.api)

    def test_create(self):
        resource = self.manager.create(**CREATE_TESTABLE_RESOURCE)
        expect = [
            ('POST', '/v1/testableresources', {}, CREATE_TESTABLE_RESOURCE),
        ]
        self.assertEqual(expect, self.api.calls)
        self.assertTrue(resource)
        self.assertIsInstance(resource, TestableResource)

    def test_create_microversion_and_global_request_id_override(self):
        resource = self.manager.create(
            **CREATE_TESTABLE_RESOURCE,
            os_ironic_api_version="1.22", global_request_id=REQ_ID)
        expect = [
            ('POST', '/v1/testableresources',
             {'X-OpenStack-Ironic-API-Version': '1.22',
              'X-Openstack-Request-Id': REQ_ID}, CREATE_TESTABLE_RESOURCE),
        ]
        self.assertEqual(expect, self.api.calls)
        self.assertTrue(resource)
        self.assertIsInstance(resource, TestableResource)

    def test_create_with_invalid_attribute(self):

# Path: ironicclient/common/base.py
# def getid(obj):
#     def __init__(self, api):
#     def _path(self, resource_id=None):
#     def resource_class(self):
#     def _resource_name(self):
#     def _get(self, resource_id, fields=None, os_ironic_api_version=None,
#              global_request_id=None):
#     def _get_as_dict(self, resource_id, fields=None,
#                      os_ironic_api_version=None, global_request_id=None):
#     def _format_body_data(self, body, response_key):
#     def _list_pagination(self, url, response_key=None, obj_class=None,
#                          limit=None, os_ironic_api_version=None,
#                          global_request_id=None):
#     def __list(self, url, response_key=None, body=None,
#                os_ironic_api_version=None, global_request_id=None):
#     def _list(self, url, response_key=None, obj_class=None, body=None,
#               os_ironic_api_version=None, global_request_id=None):
#     def _list_primitives(self, url, response_key=None,
#                          os_ironic_api_version=None, global_request_id=None):
#     def _update(self, resource_id, patch, method='PATCH',
#                 os_ironic_api_version=None, global_request_id=None,
#                 params=None):
#     def _delete(self, resource_id,
#                 os_ironic_api_version=None, global_request_id=None):
#     def _creation_attributes(self):
#     def create(self, os_ironic_api_version=None, global_request_id=None,
#                **kwargs):
#     def to_dict(self):
# class Manager(object, metaclass=abc.ABCMeta):
# class CreateManager(Manager, metaclass=abc.ABCMeta):
# class Resource(base.Resource):
# 
# Path: ironicclient/exc.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# class StateTransitionFailed(exceptions.ClientException):
# class StateTransitionTimeout(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: ironicclient/tests/unit/utils.py
# class BaseTestCase(testtools.TestCase):
# class FakeAPI(object):
# class FakeConnection(object):
# class FakeResponse(object):
#     def setUp(self):
#     def __init__(self, responses, path_prefix=None):
#     def _request(self, method, url, headers=None, body=None, params=None):
#     def raw_request(self, *args, **kwargs):
#     def json_request(self, *args, **kwargs):
#     def __init__(self, response=None, path_prefix=None):
#     def request(self, method, conn_url, **kwargs):
#     def setresponse(self, response):
#     def getresponse(self):
#     def __repr__(self):
#     def __init__(self, headers, body=None, version=None, status=None,
#                  reason=None, request_headers={}):
#     def getheaders(self):
#     def getheader(self, key, default):
#     def read(self, amt):
#     def __repr__(self):
# def mockSessionResponse(headers, content=None, status_code=None, version=None,
#                         request_headers={}):
# def mockSession(headers, content=None, status_code=None, version=None):


# Path: ironicclient/tests/unit/common/test_base.py
import copy
import testtools
from unittest import mock
from ironicclient.common import base
from ironicclient import exc
from ironicclient.tests.unit import utils

class ManagerTestCase(testtools.TestCase):

    def setUp(self):
        super(ManagerTestCase, self).setUp()
        self.api = utils.FakeAPI(fake_responses)
        self.manager = TestableManager(self.api)

    def test_create(self):
        resource = self.manager.create(**CREATE_TESTABLE_RESOURCE)
        expect = [
            ('POST', '/v1/testableresources', {}, CREATE_TESTABLE_RESOURCE),
        ]
        self.assertEqual(expect, self.api.calls)
        self.assertTrue(resource)
        self.assertIsInstance(resource, TestableResource)

    def test_create_microversion_and_global_request_id_override(self):
        resource = self.manager.create(
            **CREATE_TESTABLE_RESOURCE,
            os_ironic_api_version="1.22", global_request_id=REQ_ID)
        expect = [
            ('POST', '/v1/testableresources',
             {'X-OpenStack-Ironic-API-Version': '1.22',
              'X-Openstack-Request-Id': REQ_ID}, CREATE_TESTABLE_RESOURCE),
        ]
        self.assertEqual(expect, self.api.calls)
        self.assertTrue(resource)
        self.assertIsInstance(resource, TestableResource)

    def test_create_with_invalid_attribute(self):

        self.assertRaisesRegex(exc.InvalidAttribute, "non-existent-attribute",