# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/patterns_app/models.py
# class CustomPatternModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class CustomTypedPatternModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class CustomType(models.Model):
#     name = models.CharField(max_length=10)
# 
#     def __str__(self):
#         return self.name
# 
# class Campaign(models.Model):
#     pass
# 
# class Attribute(models.Model):
#     name = models.CharField(max_length=10)
#     campaign = models.ForeignKey(Campaign, models.CASCADE)
#     is_active = models.BooleanField()
#     category = models.CharField(max_length=10, blank=True)
# 
# class Entity(models.Model):
#     campaign = models.ForeignKey(Campaign, models.CASCADE)
# 
#     class Meta:
#         verbose_name_plural = 'entities'
# 
# Path: tests/patterns_app/serializers.py
# class EntitySerializerBase(patterns.AttachedModelSerializer):
#     values = ValueSerializerBase(many=True)
# 
#     class Meta:
#         model = Entity
#         fields = '__all__'
# 
# class EntitySerializerCampaignID(EntitySerializerBase):
#     values = ValueSerializerCampaignID(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerIsActiveT(EntitySerializerBase):
#     values = ValueSerializerIsActiveT(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerIsActiveF(EntitySerializerBase):
#     values = ValueSerializerIsActiveF(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerActiveTCampaignID(EntitySerializerBase):
#     values = ValueSerializerIsActiveTCampaignID(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryDim(EntitySerializerBase):
#     values = ValueSerializerCategoryDim(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryEmpty(EntitySerializerBase):
#     values = ValueSerializerCategoryEmpty(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryCtxt(EntitySerializerBase):
#     values = ValueSerializerCategoryCtxt(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass


from wq.db import rest
from .base import APITestCase
from rest_framework import status
from django.contrib.auth.models import User
from tests.patterns_app.models import (
    CustomPatternModel, CustomTypedPatternModel, CustomType,
    Campaign, Attribute, Entity
    )
from tests.patterns_app.serializers import (
    EntitySerializerBase, EntitySerializerCampaignID,
    EntitySerializerIsActiveT, EntitySerializerIsActiveF,
    EntitySerializerActiveTCampaignID, EntitySerializerCategoryDim,
    EntitySerializerCategoryEmpty, EntitySerializerCategoryCtxt,
    )


class CustomPatternTestCase(APITestCase):
    def setUp(self):
        self.user = User.objects.create(username='testuser', is_superuser=True)
        self.client.force_authenticate(user=self.user)
        self.type = CustomType.objects.create(
            name="Custom",
        )
        self.instance = CustomPatternModel.objects.create(
            name="Test 1",
        )
        self.typeinstance = CustomTypedPatternModel.objects.create(
            name="Test 2",
        )
        self.campaign1 = Campaign.objects.create()

# Path: tests/base.py
# class APITestCase(APITestCase):
#     client_class = APIClient
# 
# Path: tests/patterns_app/models.py
# class CustomPatternModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class CustomTypedPatternModel(models.Model):
#     name = models.CharField(max_length=10)
# 
# class CustomType(models.Model):
#     name = models.CharField(max_length=10)
# 
#     def __str__(self):
#         return self.name
# 
# class Campaign(models.Model):
#     pass
# 
# class Attribute(models.Model):
#     name = models.CharField(max_length=10)
#     campaign = models.ForeignKey(Campaign, models.CASCADE)
#     is_active = models.BooleanField()
#     category = models.CharField(max_length=10, blank=True)
# 
# class Entity(models.Model):
#     campaign = models.ForeignKey(Campaign, models.CASCADE)
# 
#     class Meta:
#         verbose_name_plural = 'entities'
# 
# Path: tests/patterns_app/serializers.py
# class EntitySerializerBase(patterns.AttachedModelSerializer):
#     values = ValueSerializerBase(many=True)
# 
#     class Meta:
#         model = Entity
#         fields = '__all__'
# 
# class EntitySerializerCampaignID(EntitySerializerBase):
#     values = ValueSerializerCampaignID(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerIsActiveT(EntitySerializerBase):
#     values = ValueSerializerIsActiveT(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerIsActiveF(EntitySerializerBase):
#     values = ValueSerializerIsActiveF(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerActiveTCampaignID(EntitySerializerBase):
#     values = ValueSerializerIsActiveTCampaignID(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryDim(EntitySerializerBase):
#     values = ValueSerializerCategoryDim(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryEmpty(EntitySerializerBase):
#     values = ValueSerializerCategoryEmpty(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass
# 
# class EntitySerializerCategoryCtxt(EntitySerializerBase):
#     values = ValueSerializerCategoryCtxt(many=True)
# 
#     class Meta(EntitySerializerBase.Meta):
#         pass


# Path: tests/test_custompatterns.py
from wq.db import rest
from .base import APITestCase
from rest_framework import status
from django.contrib.auth.models import User
from tests.patterns_app.models import (
    CustomPatternModel, CustomTypedPatternModel, CustomType,
    Campaign, Attribute, Entity
    )
from tests.patterns_app.serializers import (
    EntitySerializerBase, EntitySerializerCampaignID,
    EntitySerializerIsActiveT, EntitySerializerIsActiveF,
    EntitySerializerActiveTCampaignID, EntitySerializerCategoryDim,
    EntitySerializerCategoryEmpty, EntitySerializerCategoryCtxt,
    )



class CustomPatternTestCase(APITestCase):
    def setUp(self):
        self.user = User.objects.create(username='testuser', is_superuser=True)
        self.client.force_authenticate(user=self.user)
        self.type = CustomType.objects.create(
            name="Custom",
        )
        self.instance = CustomPatternModel.objects.create(
            name="Test 1",
        )
        self.typeinstance = CustomTypedPatternModel.objects.create(
            name="Test 2",
        )
        self.campaign1 = Campaign.objects.create()

        self.campaign2 = Campaign.objects.create()