Skip to content

Commit

Permalink
Fixed auto drop schema test
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardopires committed Sep 29, 2016
1 parent bfcd310 commit 366cbe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
7 changes: 0 additions & 7 deletions tenant_schemas/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,3 @@ class NonAutoSyncTenant(TenantMixin):

class Meta:
app_label = 'tenant_schemas'


class AutoDropTenant(TenantMixin):
auto_drop_schema = True

class Meta:
app_label = 'tenant_schemas'
10 changes: 5 additions & 5 deletions tenant_schemas/tests/test_tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dts_test_app.models import DummyModel, ModelWithFkToPublicUser

from tenant_schemas.test.cases import TenantTestCase
from tenant_schemas.tests.models import Tenant, NonAutoSyncTenant, AutoDropTenant
from tenant_schemas.tests.models import Tenant, NonAutoSyncTenant
from tenant_schemas.tests.testcases import BaseTestCase
from tenant_schemas.utils import tenant_context, schema_context, schema_exists, get_tenant_model, get_public_schema_name

Expand Down Expand Up @@ -44,12 +44,10 @@ def test_non_auto_sync_tenant(self):
When saving a tenant that has the flag auto_create_schema as
False, the schema should not be created when saving the tenant.
"""
self.assertFalse(schema_exists('non_auto_sync_tenant'))

self.assertFalse(schema_exists('non_auto_sync_tenant'))
tenant = NonAutoSyncTenant(domain_url='something.test.com',
schema_name='non_auto_sync_tenant')
tenant.save(verbosity=BaseTestCase.get_verbosity())

self.assertFalse(schema_exists(tenant.schema_name))

def test_sync_tenant(self):
Expand Down Expand Up @@ -82,7 +80,8 @@ def test_auto_drop_schema(self):
the schema associated with the tenant.
"""
self.assertFalse(schema_exists('auto_drop_tenant'))
tenant = AutoDropTenant(domain_url='something.test.com',
Tenant.auto_drop_schema = True
tenant = Tenant(domain_url='something.test.com',
schema_name='auto_drop_tenant')
tenant.save(verbosity=BaseTestCase.get_verbosity())
self.assertTrue(schema_exists(tenant.schema_name))
Expand All @@ -93,6 +92,7 @@ def test_auto_drop_schema(self):

tenant.delete()
self.assertFalse(schema_exists(tenant.schema_name))
Tenant.auto_drop_schema = False

def test_switching_search_path(self):
tenant1 = Tenant(domain_url='something.test.com',
Expand Down

0 comments on commit 366cbe3

Please sign in to comment.