bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.46k stars 423 forks source link

TenantTestCase - All tests fail when auto_create_schema is False #425

Open alexandervaneck opened 7 years ago

alexandervaneck commented 7 years ago

When auto_create_schema = False is on the TenantMixin model the TenantTestCase will not create the schema in the database, the next line connection.set_tenant(cls.tenant) then silently fails to set the tenant and the following tests will be run on the public schema.

In the docs it says It will automatically create a tenant for you, set the connection's schema to tenant's schema and make it available at `self.tenant`. This is not reflected in the implementation if auto_create_schema = False.

We should probably introduce a force_create argument as we have force_drop in the delete() method. So we can create the schema regardless of auto_create_schema.

Any thoughts?