# Path: hyperadmin/resources/models/resources.py
# class ModelResource(BaseModelResource):
#     list_endpoint = (ListEndpoint, {'index_name':'filter'})
#     create_endpoint = (CreateEndpoint, {})
#     detail_endpoint = (DetailEndpoint, {})
#     delete_endpoint = (DeleteEndpoint, {})
#     
#     def post_register(self):
#         super(ModelResource, self).post_register()
#         self.initialize_inlines()
#     
#     @property
#     def model(self):
#         return self.resource_adaptor
#     
#     def initialize_inlines(self):
#         self.inline_instances = list()
#         for inline_cls in self.inlines:
#             self.register_inline(inline_cls)
#     
#     def register_inline(self, inline_cls):
#         self.inline_instances.append(inline_cls(parent=self, api_request=self.api_request))
#     
#     def get_urls(self):
#         urlpatterns = super(ModelResource, self).get_urls()
#         for inline in self.inline_instances:
#             urlpatterns += patterns('',
#                 url('', include(inline.urls))
#             )
#         return urlpatterns
#     
#     def get_item_namespaces(self, item):
#         assert self.api_request
#         namespaces = super(ModelResource, self).get_item_namespaces(item)
#         for inline in self.inline_instances:
#             #new api request, perhaps wrap in namespace?
#             name = 'inline-%s' % inline.rel_name
#             
#             assert inline.api_request
#             
#             namespace = Namespace(name=name, endpoint=inline, state_data={'parent':item})
#             assert 'parent' in namespace.endpoint.state
#             namespace.link
#             namespaces[name] = namespace
#         return namespaces
# 
# Path: hyperadmin/tests/test_resources.py
# class ResourceTestCase(URLReverseMixin, unittest.TestCase):
#     def setUp(self):
#         self.site = ResourceSite()
#         self.site.register_builtin_media_types()
#         
#         self.user = User.objects.get_or_create(username='superuser', is_staff=True, is_active=True, is_superuser=True)[0]
#         self.resource = self.register_resource()
#         
#         self.factory = SuperUserRequestFactory(user=self.user, HTTP_ACCEPT='text/html')
#         
#         self.resolver = GenericURLResolver(r'^', self.site.get_urls())
#         
#         self.patch_reverse(self.resolver)
#     
#     def tearDown(self):
#         self.unpatch_reverse()
#     
#     def get_api_request(self, **kwargs):
#         kwargs.setdefault('site', self.site)
#         kwargs.setdefault('user', self.user)
#         kwargs.setdefault('params', {})
#         kwargs.setdefault('method', 'GET')
#         kwargs.setdefault('payload', {})
#         kwargs.setdefault('request', self.factory.get('/'))
#         api_request = InternalAPIRequest(**kwargs)
#         
#         api_request.generate_response = MagicMock(return_value=HttpResponse())
#         
#         return api_request
#     
#     def register_resource(self):
#         raise NotImplementedError


from django.contrib.contenttypes.models import ContentType
from hyperadmin.resources.models import ModelResource
from hyperadmin.tests.test_resources import ResourceTestCase
from mock import MagicMock



class MediaTypeTestCase(ResourceTestCase):
    def setUp(self):
        super(MediaTypeTestCase, self).setUp()
        self.adaptor = self.get_adaptor()
        self.adaptor.detect_redirect = MagicMock()
        self.adaptor.detect_redirect.return_value = False
    
    def get_adaptor(self):
        pass
    

# Path: hyperadmin/resources/models/resources.py
# class ModelResource(BaseModelResource):
#     list_endpoint = (ListEndpoint, {'index_name':'filter'})
#     create_endpoint = (CreateEndpoint, {})
#     detail_endpoint = (DetailEndpoint, {})
#     delete_endpoint = (DeleteEndpoint, {})
#     
#     def post_register(self):
#         super(ModelResource, self).post_register()
#         self.initialize_inlines()
#     
#     @property
#     def model(self):
#         return self.resource_adaptor
#     
#     def initialize_inlines(self):
#         self.inline_instances = list()
#         for inline_cls in self.inlines:
#             self.register_inline(inline_cls)
#     
#     def register_inline(self, inline_cls):
#         self.inline_instances.append(inline_cls(parent=self, api_request=self.api_request))
#     
#     def get_urls(self):
#         urlpatterns = super(ModelResource, self).get_urls()
#         for inline in self.inline_instances:
#             urlpatterns += patterns('',
#                 url('', include(inline.urls))
#             )
#         return urlpatterns
#     
#     def get_item_namespaces(self, item):
#         assert self.api_request
#         namespaces = super(ModelResource, self).get_item_namespaces(item)
#         for inline in self.inline_instances:
#             #new api request, perhaps wrap in namespace?
#             name = 'inline-%s' % inline.rel_name
#             
#             assert inline.api_request
#             
#             namespace = Namespace(name=name, endpoint=inline, state_data={'parent':item})
#             assert 'parent' in namespace.endpoint.state
#             namespace.link
#             namespaces[name] = namespace
#         return namespaces
# 
# Path: hyperadmin/tests/test_resources.py
# class ResourceTestCase(URLReverseMixin, unittest.TestCase):
#     def setUp(self):
#         self.site = ResourceSite()
#         self.site.register_builtin_media_types()
#         
#         self.user = User.objects.get_or_create(username='superuser', is_staff=True, is_active=True, is_superuser=True)[0]
#         self.resource = self.register_resource()
#         
#         self.factory = SuperUserRequestFactory(user=self.user, HTTP_ACCEPT='text/html')
#         
#         self.resolver = GenericURLResolver(r'^', self.site.get_urls())
#         
#         self.patch_reverse(self.resolver)
#     
#     def tearDown(self):
#         self.unpatch_reverse()
#     
#     def get_api_request(self, **kwargs):
#         kwargs.setdefault('site', self.site)
#         kwargs.setdefault('user', self.user)
#         kwargs.setdefault('params', {})
#         kwargs.setdefault('method', 'GET')
#         kwargs.setdefault('payload', {})
#         kwargs.setdefault('request', self.factory.get('/'))
#         api_request = InternalAPIRequest(**kwargs)
#         
#         api_request.generate_response = MagicMock(return_value=HttpResponse())
#         
#         return api_request
#     
#     def register_resource(self):
#         raise NotImplementedError


# Path: hyperadmin/tests/mediatypes/common.py
from django.contrib.contenttypes.models import ContentType
from hyperadmin.resources.models import ModelResource
from hyperadmin.tests.test_resources import ResourceTestCase
from mock import MagicMock




class MediaTypeTestCase(ResourceTestCase):
    def setUp(self):
        super(MediaTypeTestCase, self).setUp()
        self.adaptor = self.get_adaptor()
        self.adaptor.detect_redirect = MagicMock()
        self.adaptor.detect_redirect.return_value = False
    
    def get_adaptor(self):
        pass
    

    def register_resource(self):