# Path: tests_app/tests/functional/routers/nested_router_mixin/models.py
# class NestedRouterMixinUserModel(models.Model):
#     email = models.EmailField(blank=True, null=True)
#     name = models.CharField(max_length=10)
#     groups = models.ManyToManyField(
#         'NestedRouterMixinGroupModel', related_name='user_groups')
# 
# class NestedRouterMixinGroupModel(models.Model):
#     name = models.CharField(max_length=10)
#     permissions = models.ManyToManyField('NestedRouterMixinPermissionModel')
# 
# class NestedRouterMixinPermissionModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class NestedRouterMixinTaskModel(models.Model):
#     title = models.CharField(max_length=30)
# 
# class NestedRouterMixinBookModel(models.Model):
#     title = models.CharField(max_length=30)
# 
# class NestedRouterMixinCommentModel(models.Model):
#     content_type = models.ForeignKey(
#         "contenttypes.ContentType",
#         blank=True,
#         null=True,
#         on_delete=models.CASCADE,
#     )
#     object_id = models.PositiveIntegerField(blank=True, null=True)
#     content_object = GenericForeignKey()
#     text = models.CharField(max_length=30)


from django.test import override_settings
from rest_framework.test import APITestCase
from .models import (
    NestedRouterMixinUserModel as UserModel,
    NestedRouterMixinGroupModel as GroupModel,
    NestedRouterMixinPermissionModel as PermissionModel,
    NestedRouterMixinTaskModel as TaskModel,
    NestedRouterMixinBookModel as BookModel,
    NestedRouterMixinCommentModel as CommentModel
)
            },
            {
                'id': self.permissions['delete'].id,
                'name': self.permissions['delete'].name
            },
        ]
        self.assertEqual(response.data, expected)

    def test_permissions_detail(self):
        url = '/permissions/{0}/'.format(self.permissions['read'].id)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        expected = {
            'id': self.permissions['read'].id,
            'name': self.permissions['read'].name
        }
        self.assertEqual(response.data, expected)

    def test_permissions_groups(self):
        url = '/permissions/{0}/groups/'.format(self.permissions['update'].id)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        expected = [
            {
                'id': self.groups['admins'].id,
                'name': self.groups['admins'].name
            },
            {

# Path: tests_app/tests/functional/routers/nested_router_mixin/models.py
# class NestedRouterMixinUserModel(models.Model):
#     email = models.EmailField(blank=True, null=True)
#     name = models.CharField(max_length=10)
#     groups = models.ManyToManyField(
#         'NestedRouterMixinGroupModel', related_name='user_groups')
# 
# class NestedRouterMixinGroupModel(models.Model):
#     name = models.CharField(max_length=10)
#     permissions = models.ManyToManyField('NestedRouterMixinPermissionModel')
# 
# class NestedRouterMixinPermissionModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class NestedRouterMixinTaskModel(models.Model):
#     title = models.CharField(max_length=30)
# 
# class NestedRouterMixinBookModel(models.Model):
#     title = models.CharField(max_length=30)
# 
# class NestedRouterMixinCommentModel(models.Model):
#     content_type = models.ForeignKey(
#         "contenttypes.ContentType",
#         blank=True,
#         null=True,
#         on_delete=models.CASCADE,
#     )
#     object_id = models.PositiveIntegerField(blank=True, null=True)
#     content_object = GenericForeignKey()
#     text = models.CharField(max_length=30)


# Path: tests_app/tests/functional/routers/nested_router_mixin/tests.py
from django.test import override_settings
from rest_framework.test import APITestCase
from .models import (
    NestedRouterMixinUserModel as UserModel,
    NestedRouterMixinGroupModel as GroupModel,
    NestedRouterMixinPermissionModel as PermissionModel,
    NestedRouterMixinTaskModel as TaskModel,
    NestedRouterMixinBookModel as BookModel,
    NestedRouterMixinCommentModel as CommentModel
)

            },
            {
                'id': self.permissions['delete'].id,
                'name': self.permissions['delete'].name
            },
        ]
        self.assertEqual(response.data, expected)

    def test_permissions_detail(self):
        url = '/permissions/{0}/'.format(self.permissions['read'].id)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        expected = {
            'id': self.permissions['read'].id,
            'name': self.permissions['read'].name
        }
        self.assertEqual(response.data, expected)

    def test_permissions_groups(self):
        url = '/permissions/{0}/groups/'.format(self.permissions['update'].id)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        expected = [
            {
                'id': self.groups['admins'].id,
                'name': self.groups['admins'].name
            },
            {

                'id': self.groups['super_admins'].id,