# Path: boardinghouse/schema.py
# def get_schema_model():
#     """
#     Return the class that is currently set as the schema model.
#     """
#     try:
#         return apps.get_model(settings.BOARDINGHOUSE_SCHEMA_MODEL)
#     except AttributeError:
#         raise ImproperlyConfigured("BOARDINGHOUSE_SCHEMA_MODEL is not set: is 'boardinghouse' in your INSTALLED_APPS?")
#     except ValueError:
#         raise ImproperlyConfigured("BOARDINGHOUSE_SCHEMA_MODEL must be of the form 'app_label.model_name'")
#     except LookupError:
#         raise ImproperlyConfigured(
#             "BOARDINGHOUSE_SCHEMA_MODEL refers to model '{0!s}' that has not been installed".format(
#                 settings.BOARDINGHOUSE_SCHEMA_MODEL))
# 
# 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)


from django.test import TestCase
from boardinghouse.schema import get_schema_model
from ..models import AwareModel, NaiveModel
        first.activate()
        self.assertRaises(AwareModel.DoesNotExist, AwareModel.objects.get, name='Baz object')

    def test_boardinghouse_manager(self):
        first, second = Schema.objects.mass_create('first', 'second')

        first.activate()
        AwareModel.objects.create(name="Foo object").name
        AwareModel.objects.create(name="Bar object").name

        second.activate()
        baz = AwareModel.objects.create(name="Baz object").name

        second.deactivate()

        self.assertEqual(3, len(list(AwareModel.objects.from_schemata(Schema.objects.all()))))

        self.assertEqual([baz], [x.name for x in AwareModel.objects.from_schemata(second)])
        self.assertNotIn(baz, [x.name for x in AwareModel.objects.from_schemata(first)])

    def test_naive_objects_are_created_in_public_schema(self):
        first, second = Schema.objects.mass_create('first', 'second')

        NaiveModel.objects.create(name="Public")

        first.activate()
        self.assertEqual(1, NaiveModel.objects.count())
        NaiveModel.objects.create(name="First")

        second.activate()

# Path: boardinghouse/schema.py
# def get_schema_model():
#     """
#     Return the class that is currently set as the schema model.
#     """
#     try:
#         return apps.get_model(settings.BOARDINGHOUSE_SCHEMA_MODEL)
#     except AttributeError:
#         raise ImproperlyConfigured("BOARDINGHOUSE_SCHEMA_MODEL is not set: is 'boardinghouse' in your INSTALLED_APPS?")
#     except ValueError:
#         raise ImproperlyConfigured("BOARDINGHOUSE_SCHEMA_MODEL must be of the form 'app_label.model_name'")
#     except LookupError:
#         raise ImproperlyConfigured(
#             "BOARDINGHOUSE_SCHEMA_MODEL refers to model '{0!s}' that has not been installed".format(
#                 settings.BOARDINGHOUSE_SCHEMA_MODEL))
# 
# 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: tests/tests/test_objects_are_partitioned.py
from django.test import TestCase
from boardinghouse.schema import get_schema_model
from ..models import AwareModel, NaiveModel

        first.activate()
        self.assertRaises(AwareModel.DoesNotExist, AwareModel.objects.get, name='Baz object')

    def test_boardinghouse_manager(self):
        first, second = Schema.objects.mass_create('first', 'second')

        first.activate()
        AwareModel.objects.create(name="Foo object").name
        AwareModel.objects.create(name="Bar object").name

        second.activate()
        baz = AwareModel.objects.create(name="Baz object").name

        second.deactivate()

        self.assertEqual(3, len(list(AwareModel.objects.from_schemata(Schema.objects.all()))))

        self.assertEqual([baz], [x.name for x in AwareModel.objects.from_schemata(second)])
        self.assertNotIn(baz, [x.name for x in AwareModel.objects.from_schemata(first)])

    def test_naive_objects_are_created_in_public_schema(self):
        first, second = Schema.objects.mass_create('first', 'second')

        NaiveModel.objects.create(name="Public")

        first.activate()
        self.assertEqual(1, NaiveModel.objects.count())
        NaiveModel.objects.create(name="First")

        second.activate()

        self.assertEqual(2, NaiveModel.objects.count())