# 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):
# class NaiveModel(SharedSchemaModel):
# class SelfReferentialModel(models.Model):
# class CoReferentialModelA(models.Model):
# class CoReferentialModelB(models.Model):
# class ModelA(models.Model):
# class ModelB(models.Model):
# class ModelBPrefix(models.Model):
# class SettingsSharedModel(models.Model):
# class SettingsPrivateModel(models.Model):
# class ViewBackedModel(models.Model):
#     class Meta:


from unittest import TestCase
from django.test import Client
from boardinghouse.schema import get_schema_model
from ..models import AwareModel, User
from __future__ import unicode_literals




Schema = get_schema_model()


class TestMultipleClients(TestCase):
    def test_simultaneous_access(self):
        schema_a, schema_b = Schema.objects.mass_create('a', 'b')

        user_a = User.objects.create_user(
            username='a', email='a@example.com', password='a'
        )
        user_b = User.objects.create_user(
            username='b', email='b@example.com', password='b'
        )

        schema_a.activate()
        AwareModel.objects.create(name='foo')
        schema_b.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):
# class NaiveModel(SharedSchemaModel):
# class SelfReferentialModel(models.Model):
# class CoReferentialModelA(models.Model):
# class CoReferentialModelB(models.Model):
# class ModelA(models.Model):
# class ModelB(models.Model):
# class ModelBPrefix(models.Model):
# class SettingsSharedModel(models.Model):
# class SettingsPrivateModel(models.Model):
# class ViewBackedModel(models.Model):
#     class Meta:


# Path: tests/tests/test_multiple_clients.py
from unittest import TestCase
from django.test import Client
from boardinghouse.schema import get_schema_model
from ..models import AwareModel, User

from __future__ import unicode_literals




Schema = get_schema_model()


class TestMultipleClients(TestCase):
    def test_simultaneous_access(self):
        schema_a, schema_b = Schema.objects.mass_create('a', 'b')

        user_a = User.objects.create_user(
            username='a', email='a@example.com', password='a'
        )
        user_b = User.objects.create_user(
            username='b', email='b@example.com', password='b'
        )

        schema_a.activate()
        AwareModel.objects.create(name='foo')
        schema_b.activate()

        AwareModel.objects.create(name='bar')