1

Trying to run test cases using FastTenantTestCase, following are the package versions:

django - 3.2.16 django-tenants - 3.3.4

Sample code:


from django_tenants.test.cases import FastTenantTestCase

class TestWorkflowDocumentCategories(FastTenantTestCase):
    """
    class to test workflow document categories
    """
    def setUp(self) -> None:
            self.client = TenantClient(self.tenant)
            self.url = reverse('sample-url-list')
            self.existing_document_categories = {'xyz'}
            self.factory = SampleFactory()

    def test_document_categories_list(self) -> None:
        response = self.client.get(self.url, {}, **self.header)
        self.assertEqual(response.status_code, status.HTTP_200_OK)

ERROR:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django_tenants/test/cases.py", line 134, in setup_test_tenant_and_domain
    cls.tenant.save(verbosity=cls.get_verbosity())
  File "/usr/local/lib/python3.9/site-packages/django_tenants/models.py", line 100, in save
    raise Exception("Can't create tenant outside the public schema. "
Exception: Can't create tenant outside the public schema. Current schema is fast_test.

Can anyone suggest solution to solve this issue?

we tried to over ride setUpClass method but still isn't resolved

Mech.py
  • 11
  • 1

0 Answers0