Projet

Général

Profil

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

Benjamin Dauvergne, 05 octobre 2015 21:19

Télécharger (1,48 ko)

Voir les différences:

Subject: [PATCH 2/8] multitenant: allow testing multitenant applications
 (#8425)

Django setup of db for tests always call "migrate" which the multitenant
application inactivate. This commit redirect this command to migrate-schemas
if we know that we are currently testing. 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
-