# Path: test_abstract/models.py
# class CustomOrganization(AbstractOrganization):
#     street_address = models.CharField(max_length=100, default="")
#     city = models.CharField(max_length=100, default="")
# 
# Path: test_accounts/models.py
# class Account(OrganizationBase):
#     monthly_subscription = models.IntegerField(default=1000)
# 
# Path: test_accounts/models.py
# class AccountInvitation(OrganizationInvitationBase):
# 
#     def get_absolute_url(self):
#         """Returns the invitation URL"""
#         return reverse(
#             "test_accounts:account_invitations:invitations_register",
#             kwargs={"guid": str(self.guid)},
#         )


from functools import partial
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.test import TestCase
from django.test.utils import override_settings
from organizations.models import Organization
from organizations.models import OrganizationInvitation
from organizations.models import OrganizationOwner
from organizations.models import OrganizationUser
from organizations.utils import create_organization
from test_abstract.models import CustomOrganization
from test_accounts.models import Account
from test_accounts.models import AccountInvitation
from test_custom.models import Team
        from organizations.exceptions import OwnershipRequired
        from organizations.exceptions import OrganizationMismatch

    def test_delete_account(self):
        """Ensure Users are not deleted on the cascade"""
        self.assertEqual(3, OrganizationOwner.objects.all().count())
        self.assertEqual(4, User.objects.all().count())
        scream = Organization.objects.get(name="Scream")
        scream.delete()
        self.assertEqual(2, OrganizationOwner.objects.all().count())
        self.assertEqual(4, User.objects.all().count())

    def test_delete_orguser(self):
        """Ensure the user is not deleted on the cascade"""
        krist = User.objects.get(username="krist")
        org_user = OrganizationUser.objects.filter(
            organization__name="Nirvana", user=krist
        )
        org_user.delete()
        self.assertTrue(krist.pk)


class CustomModelTests(TestCase):

    # Load the world as we know it.
    fixtures = ["users.json", "orgs.json"]

    def setUp(self):
        self.kurt = User.objects.get(username="kurt")
        self.dave = User.objects.get(username="dave")
        self.krist = User.objects.get(username="krist")
        self.duder = User.objects.get(username="duder")

# Path: test_abstract/models.py
# class CustomOrganization(AbstractOrganization):
#     street_address = models.CharField(max_length=100, default="")
#     city = models.CharField(max_length=100, default="")
# 
# Path: test_accounts/models.py
# class Account(OrganizationBase):
#     monthly_subscription = models.IntegerField(default=1000)
# 
# Path: test_accounts/models.py
# class AccountInvitation(OrganizationInvitationBase):
# 
#     def get_absolute_url(self):
#         """Returns the invitation URL"""
#         return reverse(
#             "test_accounts:account_invitations:invitations_register",
#             kwargs={"guid": str(self.guid)},
#         )


# Path: tests/test_models.py
from functools import partial
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.test import TestCase
from django.test.utils import override_settings
from organizations.models import Organization
from organizations.models import OrganizationInvitation
from organizations.models import OrganizationOwner
from organizations.models import OrganizationUser
from organizations.utils import create_organization
from test_abstract.models import CustomOrganization
from test_accounts.models import Account
from test_accounts.models import AccountInvitation
from test_custom.models import Team
        from organizations.exceptions import OwnershipRequired
        from organizations.exceptions import OrganizationMismatch


    def test_delete_account(self):
        """Ensure Users are not deleted on the cascade"""
        self.assertEqual(3, OrganizationOwner.objects.all().count())
        self.assertEqual(4, User.objects.all().count())
        scream = Organization.objects.get(name="Scream")
        scream.delete()
        self.assertEqual(2, OrganizationOwner.objects.all().count())
        self.assertEqual(4, User.objects.all().count())

    def test_delete_orguser(self):
        """Ensure the user is not deleted on the cascade"""
        krist = User.objects.get(username="krist")
        org_user = OrganizationUser.objects.filter(
            organization__name="Nirvana", user=krist
        )
        org_user.delete()
        self.assertTrue(krist.pk)


class CustomModelTests(TestCase):

    # Load the world as we know it.
    fixtures = ["users.json", "orgs.json"]

    def setUp(self):
        self.kurt = User.objects.get(username="kurt")
        self.dave = User.objects.get(username="dave")
        self.krist = User.objects.get(username="krist")
        self.duder = User.objects.get(username="duder")

        self.red_account = Account.objects.create(