Added missing method to TenantTestCase. Fixes #227.

This commit is contained in:
Bernardo Pires 2015-01-16 15:59:06 +01:00
parent 45c9ee95a0
commit d98b70005f
1 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,10 @@
import django
from django.core.management import call_command
from django.db import connection
from django.test import TestCase
from tenant_schemas.utils import get_tenant_model
from tenant_schemas.utils import get_public_schema_name
class TenantTestCase(TestCase):
@ -20,3 +24,20 @@ class TenantTestCase(TestCase):
cursor = connection.cursor()
cursor.execute('DROP SCHEMA test CASCADE')
@classmethod
def sync_shared(cls):
if django.VERSION >= (1, 7, 0):
call_command('migrate_schemas',
schema_name=get_public_schema_name(),
interactive=False,
verbosity=0)
else:
call_command('sync_schemas',
schema_name=get_public_schema_name(),
tenant=False,
public=True,
interactive=False,
migrate_all=True,
verbosity=0,
)