# 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,
    )
        self.att4 = Attribute.objects.create(
            name='Size',
            is_active=False,
            campaign=self.campaign2,
            category=''
            )

    def test_customtypedpattern_config(self):
        response = self.client.get('/config.json')
        self.assertEqual([
            {
                'name': 'name',
                'label': 'Name',
                'type': 'string',
                'bind': {'required': True},
                'wq:length': 10,
            }, {
                'name': 'attachments',
                'label': 'Attachments',
                'type': 'repeat',
                'bind': {'required': True},
                'children': [{
                    'name': 'name',
                    'label': 'Name',
                    'type': 'string',
                    'wq:length': 10,
                }, {
                    'name': 'value',
                    'label': 'Value',
                    'type': 'decimal',

# 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,
    )

        self.att4 = Attribute.objects.create(
            name='Size',
            is_active=False,
            campaign=self.campaign2,
            category=''
            )

    def test_customtypedpattern_config(self):
        response = self.client.get('/config.json')
        self.assertEqual([
            {
                'name': 'name',
                'label': 'Name',
                'type': 'string',
                'bind': {'required': True},
                'wq:length': 10,
            }, {
                'name': 'attachments',
                'label': 'Attachments',
                'type': 'repeat',
                'bind': {'required': True},
                'children': [{
                    'name': 'name',
                    'label': 'Name',
                    'type': 'string',
                    'wq:length': 10,
                }, {
                    'name': 'value',
                    'label': 'Value',
                    'type': 'decimal',

                }, {