# 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 Child(LabelModel):
#     name = models.CharField(max_length=10)
#     parent = models.ForeignKey(Parent, models.CASCADE, related_name="children")
# 
# class ItemType(LabelModel):
#     name = models.CharField(max_length=10)
#     active = models.NullBooleanField(default=True)
# 
# class Item(LabelModel):
#     name = models.CharField(max_length=10)
#     type = models.ForeignKey(ItemType, models.CASCADE)
# 
#     class Meta:
#         ordering = ('type', 'name')
# 
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)
# 
# class SlugRefParent(LabelModel):
#     ref = models.ForeignKey(SlugModel, models.CASCADE)
#     name = models.CharField(max_length=255)
# 
#     wq_label_template = "{{name}}{{#ref_id}} ({{ref}}){{/ref_id}}"
# 
# class ChoiceModel(LabelModel):
#     CHOICE_CHOICES = [
#         ('one', 'Choice One'),
#         ('two', 'Choice Two'),
#         ('three', 'Choice Three'),
#     ]
#     name = models.CharField(
#         max_length=10,
#         help_text='Enter Name',
#     )
#     choice = models.CharField(
#         max_length=10,
#         help_text='Pick One',
#         choices=CHOICE_CHOICES,
#     )
# 
#     wq_label_template = "{{name}}: {{choice}}"


from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import (
    RootModel, OneToOneModel, ForeignKeyModel, ExtraModel, UserManagedModel,
    Parent, Child, ItemType, Item, SlugModel, SlugRefParent, ChoiceModel,
)
from django.contrib.auth.models import User
from django.conf import settings
              <li><a href="/children/{c2_pk}">Test 2</a></li>
            </ul>
        """.format(
            c1_pk=childs[0].pk,
            c2_pk=childs[1].pk,
        ))

        items = ItemType.objects.get(pk=1).item_set.order_by('pk')
        self.check_html('/itemtypes/1/items', """
            <h3><a href="/itemtypes/1">Test</a> Items</h3>
            <ul>
              <li><a href="/items/{i1_pk}">Test 1</a></li>
              <li><a href="/items/{i2_pk}">Test 2</a></li>
            </ul>
        """.format(
            i1_pk=items[0].pk,
            i2_pk=items[1].pk,
        ))

    def test_template_detail_user_serializer(self):
        self.check_html('/usermanagedmodels/1', """
            <h1>Object #1</h1>
            <p>Created by testuser</p>
            <p></p>
        """)

    def test_template_custom_lookup(self):
        self.check_html('/slugmodels/test', "<h1>Test</h1>")

    def test_template_default_per_page(self):

# 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 Child(LabelModel):
#     name = models.CharField(max_length=10)
#     parent = models.ForeignKey(Parent, models.CASCADE, related_name="children")
# 
# class ItemType(LabelModel):
#     name = models.CharField(max_length=10)
#     active = models.NullBooleanField(default=True)
# 
# class Item(LabelModel):
#     name = models.CharField(max_length=10)
#     type = models.ForeignKey(ItemType, models.CASCADE)
# 
#     class Meta:
#         ordering = ('type', 'name')
# 
# class SlugModel(LabelModel):
#     code = models.SlugField()
#     name = models.CharField(max_length=255)
# 
# class SlugRefParent(LabelModel):
#     ref = models.ForeignKey(SlugModel, models.CASCADE)
#     name = models.CharField(max_length=255)
# 
#     wq_label_template = "{{name}}{{#ref_id}} ({{ref}}){{/ref_id}}"
# 
# class ChoiceModel(LabelModel):
#     CHOICE_CHOICES = [
#         ('one', 'Choice One'),
#         ('two', 'Choice Two'),
#         ('three', 'Choice Three'),
#     ]
#     name = models.CharField(
#         max_length=10,
#         help_text='Enter Name',
#     )
#     choice = models.CharField(
#         max_length=10,
#         help_text='Pick One',
#         choices=CHOICE_CHOICES,
#     )
# 
#     wq_label_template = "{{name}}: {{choice}}"


# Path: tests/test_template.py
from .base import APITestCase
from rest_framework import status
from tests.rest_app.models import (
    RootModel, OneToOneModel, ForeignKeyModel, ExtraModel, UserManagedModel,
    Parent, Child, ItemType, Item, SlugModel, SlugRefParent, ChoiceModel,
)
from django.contrib.auth.models import User
from django.conf import settings

              <li><a href="/children/{c2_pk}">Test 2</a></li>
            </ul>
        """.format(
            c1_pk=childs[0].pk,
            c2_pk=childs[1].pk,
        ))

        items = ItemType.objects.get(pk=1).item_set.order_by('pk')
        self.check_html('/itemtypes/1/items', """
            <h3><a href="/itemtypes/1">Test</a> Items</h3>
            <ul>
              <li><a href="/items/{i1_pk}">Test 1</a></li>
              <li><a href="/items/{i2_pk}">Test 2</a></li>
            </ul>
        """.format(
            i1_pk=items[0].pk,
            i2_pk=items[1].pk,
        ))

    def test_template_detail_user_serializer(self):
        self.check_html('/usermanagedmodels/1', """
            <h1>Object #1</h1>
            <p>Created by testuser</p>
            <p></p>
        """)

    def test_template_custom_lookup(self):
        self.check_html('/slugmodels/test', "<h1>Test</h1>")

    def test_template_default_per_page(self):

        parent = Parent.objects.get(pk=1)