0

I am using django_tenants and I have an API to create a new tenant. In this API we initialize data in some models from fixtures.

execute_from_command_line(["manage.py", "tenant_command", "loaddata",
"core/fixtures/"+file, "-s", self.schema_name])

I am now writing Tests on this API using APITestCase. The test creates the database schema but fails on the fixture command (which works fine outside of Test cases).

The error is "django.core.management.base.CommandError: Invalid tenant schema, 'la_poste'"

I believe the issue is that the command is executed in the real DB and not the Test DB. tenant_command does not seem to have a "database" option.

Can I still test this ?

Thanks

Lucas
  • 271
  • 2
  • 4
  • 12

0 Answers0