Projet

Général

Profil

0002-multitenant-allow-testing-multitenant-applications.patch

Benjamin Dauvergne, 30 septembre 2015 10:23

Télécharger (1,47 ko)

Voir les différences:

Subject: [PATCH 2/3] multitenant: allow testing multitenant applications

Django setup of db for tests always call "migrate" which the multitenant
application inactivate. This commit redirect this command to migrate-schemas
if we known that we are currently in a test. It's copied from
django-tenant-schemas.
 hobo/multitenant/management/commands/migrate.py | 5 +++++
 1 file changed, 5 insertions(+)
hobo/multitenant/management/commands/migrate.py
6 6
import django
7 7
from django.conf import settings
8 8
from django.core.management.base import CommandError, BaseCommand
9
from tenant_schemas.utils import django_is_in_test_mode
9 10

  
10 11
if django.VERSION < (1, 7, 0):
11 12
    try:
......
25 26
                               "instead. Please read the documentation if you don't know why you "
26 27
                               "shouldn't call migrate directly!".format(database))
27 28
        super(Command, self).handle(*args, **options)
29

  
30
if django.VERSION >= (1, 7, 0) and django_is_in_test_mode():
31
    from .migrate_schemas import MigrateSchemasCommand
32
    Command = MigrateSchemasCommand
28
-