# Path: tests/models.py
# class AwareModel(models.Model):
#     name = models.CharField(max_length=10, unique=True)
#     status = models.BooleanField(default=False)
#     factor = models.PositiveSmallIntegerField(default=7)
# 
#     objects = MultiSchemaManager()
# 
# class NaiveModel(SharedSchemaModel):
#     name = models.CharField(max_length=10, unique=True)
#     status = models.BooleanField(default=False)
# 
# Path: boardinghouse/templatetags/boardinghouse.py
# @register.filter
# def schema_name(schema):
#     for handler, response in find_schema.send(sender=None, schema=schema):
#         if response:
#             return response.name
#     return 'no schema'
# 
# @register.filter
# def is_schema_aware(obj):
#     return obj and not _is_shared_model(obj)
# 
# @register.filter
# def is_shared_model(obj):
#     return obj and _is_shared_model(obj)
# 
# Path: boardinghouse/models.py
# class Schema(AbstractSchema):
#     """
#     The default schema model.
# 
#     Unless you set `settings.BOARDINGHOUSE_SCHEMA_MODEL`, this model will
#     be used for storing the schema objects.
#     """
#     users = models.ManyToManyField(
#         settings.AUTH_USER_MODEL,
#         blank=True, related_name='schemata',
#         help_text=_(u'Which users may access data from this schema.')
#     )
# 
#     class Meta:
#         app_label = 'boardinghouse'
#         verbose_name_plural = 'schemata'
#         swappable = 'BOARDINGHOUSE_SCHEMA_MODEL'


from django.test import TestCase
from ..models import AwareModel, NaiveModel
from boardinghouse.templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
from boardinghouse.models import Schema


class TestTemplateTags(TestCase):
    def test_is_schema_aware_filter(self):
        self.assertTrue(is_schema_aware(AwareModel()))

# Path: tests/models.py
# class AwareModel(models.Model):
#     name = models.CharField(max_length=10, unique=True)
#     status = models.BooleanField(default=False)
#     factor = models.PositiveSmallIntegerField(default=7)
# 
#     objects = MultiSchemaManager()
# 
# class NaiveModel(SharedSchemaModel):
#     name = models.CharField(max_length=10, unique=True)
#     status = models.BooleanField(default=False)
# 
# Path: boardinghouse/templatetags/boardinghouse.py
# @register.filter
# def schema_name(schema):
#     for handler, response in find_schema.send(sender=None, schema=schema):
#         if response:
#             return response.name
#     return 'no schema'
# 
# @register.filter
# def is_schema_aware(obj):
#     return obj and not _is_shared_model(obj)
# 
# @register.filter
# def is_shared_model(obj):
#     return obj and _is_shared_model(obj)
# 
# Path: boardinghouse/models.py
# class Schema(AbstractSchema):
#     """
#     The default schema model.
# 
#     Unless you set `settings.BOARDINGHOUSE_SCHEMA_MODEL`, this model will
#     be used for storing the schema objects.
#     """
#     users = models.ManyToManyField(
#         settings.AUTH_USER_MODEL,
#         blank=True, related_name='schemata',
#         help_text=_(u'Which users may access data from this schema.')
#     )
# 
#     class Meta:
#         app_label = 'boardinghouse'
#         verbose_name_plural = 'schemata'
#         swappable = 'BOARDINGHOUSE_SCHEMA_MODEL'


# Path: tests/tests/test_template_tag.py
from django.test import TestCase
from ..models import AwareModel, NaiveModel
from boardinghouse.templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
from boardinghouse.models import Schema



class TestTemplateTags(TestCase):
    def test_is_schema_aware_filter(self):
        self.assertTrue(is_schema_aware(AwareModel()))

        self.assertFalse(is_schema_aware(NaiveModel()))