# Path: wwwhisper_auth/models.py
# class LimitExceeded(Exception):
#     pass
# 
# Path: wwwhisper_auth/models.py
# class SitesCollection(object):
#     def create_item(self, site_id, **kwargs):
#         """Creates a new Site object.
# 
#         Args:
#            site_id: A domain or other id of the created site.
#         Raises:
#            ValidationError if a site with a given id already exists.
#         """
#         site =  Site.objects.create(site_id=site_id, **kwargs)
#         site.heavy_init()
#         return site
# 
#     def find_item(self, site_id):
#         site = _find(Site, site_id=site_id)
#         if site is not None:
#             site.heavy_init()
#         return site
# 
#     def delete_item(self, site_id):
#         site = self.find_item(site_id)
#         if site is None:
#             return False
#         # Users, Locations and Permissions have foreign key to the Site
#         # and are deleted automatically.
#         site.delete()
#         return True


from django.db import transaction
from django.forms import ValidationError
from django.test import TestCase
from contextlib import contextmanager
from functools import wraps
from wwwhisper_auth.models import LimitExceeded
from wwwhisper_auth.models import SitesCollection
    def test_assert_site_modified(self):
        with self.assert_site_modified(self.site):
            self.site.site_modified()
        # Should not raise anything

    def test_assert_site_not_modified(self):
        with self.assert_site_not_modified(self.site):
            pass
        # Should not raise anything

    def test_assert_site_modified_raises(self):
        try:
            with self.assert_site_modified(self.site):
                pass
        except AssertionError as er:
            pass # Expected.
        else:
            self.fail('Assertion not raised')

    def test_assert_site_not_modified_raises(self):
        try:
            with self.assert_site_not_modified(self.site):
                self.site.site_modified()
        except AssertionError as er:
            pass # Expected.
        else:
            self.fail('Assertion not raised')

class SitesTest(ModelTestCase):
    def test_create_site(self):

# Path: wwwhisper_auth/models.py
# class LimitExceeded(Exception):
#     pass
# 
# Path: wwwhisper_auth/models.py
# class SitesCollection(object):
#     def create_item(self, site_id, **kwargs):
#         """Creates a new Site object.
# 
#         Args:
#            site_id: A domain or other id of the created site.
#         Raises:
#            ValidationError if a site with a given id already exists.
#         """
#         site =  Site.objects.create(site_id=site_id, **kwargs)
#         site.heavy_init()
#         return site
# 
#     def find_item(self, site_id):
#         site = _find(Site, site_id=site_id)
#         if site is not None:
#             site.heavy_init()
#         return site
# 
#     def delete_item(self, site_id):
#         site = self.find_item(site_id)
#         if site is None:
#             return False
#         # Users, Locations and Permissions have foreign key to the Site
#         # and are deleted automatically.
#         site.delete()
#         return True


# Path: wwwhisper_auth/tests/tests_models.py
from django.db import transaction
from django.forms import ValidationError
from django.test import TestCase
from contextlib import contextmanager
from functools import wraps
from wwwhisper_auth.models import LimitExceeded
from wwwhisper_auth.models import SitesCollection

    def test_assert_site_modified(self):
        with self.assert_site_modified(self.site):
            self.site.site_modified()
        # Should not raise anything

    def test_assert_site_not_modified(self):
        with self.assert_site_not_modified(self.site):
            pass
        # Should not raise anything

    def test_assert_site_modified_raises(self):
        try:
            with self.assert_site_modified(self.site):
                pass
        except AssertionError as er:
            pass # Expected.
        else:
            self.fail('Assertion not raised')

    def test_assert_site_not_modified_raises(self):
        try:
            with self.assert_site_not_modified(self.site):
                self.site.site_modified()
        except AssertionError as er:
            pass # Expected.
        else:
            self.fail('Assertion not raised')

class SitesTest(ModelTestCase):
    def test_create_site(self):

        self.assertEqual(TEST_SITE, self.site.site_id)