# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/rest_app/models.py
# class RootModel(LabelModel):
#     slug = models.SlugField()
#     description = models.TextField()
# 
#     wq_label_template = "{{slug}}"
# 
# class OneToOneModel(LabelModel):
#     root = models.OneToOneField(RootModel, models.CASCADE)
# 
#     wq_label_template = "onetoonemodel for {{root}}"
# 
# class ForeignKeyModel(LabelModel):
#     root = models.ForeignKey(RootModel, models.CASCADE)
# 
#     wq_label_template = "foreignkeymodel for {{root}}"
# 
# class ExtraModel(LabelModel):
#     root = models.ForeignKey(
#         RootModel,
#         models.CASCADE,
#         related_name="extramodels",
#     )
#     alt_root = models.ForeignKey(
#         RootModel,
#         models.CASCADE,
#         related_name="extramodel_set",
#         null=True,
#         blank=True,
#     )
# 
#     wq_label_template = "extramodel for {{root}}"
# 
# class UserManagedModel(models.Model):
#     user = models.ForeignKey("auth.User", models.CASCADE)
# 
# class Parent(LabelModel):
#     name = models.CharField(max_length=10)
# 
# class ItemType(LabelModel):
#     name = models.CharField(max_length=10)
#     active = models.NullBooleanField(default=True)
# 
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)


from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import (
    RootModel, OneToOneModel, ForeignKeyModel, ExtraModel, UserManagedModel,
    Parent, ItemType, SlugModel,
)
from django.contrib.auth.models import User
        response = self.client.get(
            "/multi.json?lists=" + ",".join(lists)
        )
        for listurl in lists:
            self.assertIn(listurl, response.data)
            self.assertIn("list", response.data[listurl])
            self.assertGreater(len(response.data[listurl]["list"]), 0)

    def test_rest_custom_lookup(self):
        response = self.client.get('/slugmodels/test.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['id'], 'test')

    def test_rest_default_per_page(self):
        response = self.client.get('/parents.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 50)

    def test_rest_custom_per_page(self):
        response = self.client.get('/children.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 100)

    def test_rest_limit(self):
        response = self.client.get('/children.json?limit=10')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 10)

    def test_rest_cache_all(self):
        for num in range(2, 101):

# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/rest_app/models.py
# class RootModel(LabelModel):
#     slug = models.SlugField()
#     description = models.TextField()
# 
#     wq_label_template = "{{slug}}"
# 
# class OneToOneModel(LabelModel):
#     root = models.OneToOneField(RootModel, models.CASCADE)
# 
#     wq_label_template = "onetoonemodel for {{root}}"
# 
# class ForeignKeyModel(LabelModel):
#     root = models.ForeignKey(RootModel, models.CASCADE)
# 
#     wq_label_template = "foreignkeymodel for {{root}}"
# 
# class ExtraModel(LabelModel):
#     root = models.ForeignKey(
#         RootModel,
#         models.CASCADE,
#         related_name="extramodels",
#     )
#     alt_root = models.ForeignKey(
#         RootModel,
#         models.CASCADE,
#         related_name="extramodel_set",
#         null=True,
#         blank=True,
#     )
# 
#     wq_label_template = "extramodel for {{root}}"
# 
# class UserManagedModel(models.Model):
#     user = models.ForeignKey("auth.User", models.CASCADE)
# 
# class Parent(LabelModel):
#     name = models.CharField(max_length=10)
# 
# class ItemType(LabelModel):
#     name = models.CharField(max_length=10)
#     active = models.NullBooleanField(default=True)
# 
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)


# Path: tests/test_rest.py
from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import (
    RootModel, OneToOneModel, ForeignKeyModel, ExtraModel, UserManagedModel,
    Parent, ItemType, SlugModel,
)
from django.contrib.auth.models import User

        response = self.client.get(
            "/multi.json?lists=" + ",".join(lists)
        )
        for listurl in lists:
            self.assertIn(listurl, response.data)
            self.assertIn("list", response.data[listurl])
            self.assertGreater(len(response.data[listurl]["list"]), 0)

    def test_rest_custom_lookup(self):
        response = self.client.get('/slugmodels/test.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['id'], 'test')

    def test_rest_default_per_page(self):
        response = self.client.get('/parents.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 50)

    def test_rest_custom_per_page(self):
        response = self.client.get('/children.json')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 100)

    def test_rest_limit(self):
        response = self.client.get('/children.json?limit=10')
        self.assertTrue(status.is_success(response.status_code), response.data)
        self.assertEqual(response.data['per_page'], 10)

    def test_rest_cache_all(self):
        for num in range(2, 101):

            ItemType.objects.create(