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

extending TenantTestCase results into an Intergrity error due to extra fields that the setup method does not provide values for. #438

Open ntwarijoshua opened 7 years ago

ntwarijoshua commented 7 years ago

====================================================================== ERROR: setUpClass (public_site.tests.TestTenantModel)

Traceback (most recent call last): File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/tenant_schemas/test/cases.py", line 15, in setUpClass cls.tenant.save(verbosity=0) # todo: is there any way to get the verbosity from the test command here? File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/tenant_schemas/models.py", line 45, in save super(TenantMixin, self).save(*args, *kwargs) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/base.py", line 796, in save force_update=force_update, update_fields=update_fields) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/base.py", line 824, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/base.py", line 908, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/base.py", line 947, in _do_insert using=using, raw=raw) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(args, **kwargs) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/query.py", line 1045, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1054, in execute_sql cursor.execute(sql, params) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/utils.py", line 94, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Users/Josh/Documents/Sites/pyenv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) IntegrityError: null value in column "paid_until" violates not-null constraint DETAIL: Failing row contains (1, tenant.test.com, test, , null, null, 2017-02-13).

bernardopires commented 7 years ago

This post really does not have enough information. How does your extended test case look like? What command did you use to run the tests?