From eece38c7919ba93998ac0c573d39c915cad023f7 Mon Sep 17 00:00:00 2001 From: Agate Berriot Date: Wed, 10 Aug 2022 14:55:22 +0200 Subject: [PATCH 6/6] WIP --- Jenkinsfile | 2 +- tests_authentic/conftest.py | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e1ccbe9..530ffbf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stages { stage('Unit Tests') { steps { - sh 'tox -rv -p 8' + sh 'tox -e py3-django32-authentic -- tests_authentic/test_provisionning.py -vvv -s' } post { always { diff --git a/tests_authentic/conftest.py b/tests_authentic/conftest.py index 23410c4..6ab7f98 100644 --- a/tests_authentic/conftest.py +++ b/tests_authentic/conftest.py @@ -76,8 +76,7 @@ def tenant_factory(transactional_db, tenant_base, settings): schema_name = name.replace('-', '_').replace('.', '_') t = Tenant(domain_url=name, schema_name=schema_name) with transaction.atomic(): - t.create_schema(check_if_exists=True) - connection.set_schema_to_public() + t.create_schema() tenants.append(t) return t @@ -87,17 +86,9 @@ def tenant_factory(transactional_db, tenant_base, settings): finally: # cleanup all created tenants connection.set_schema_to_public() - for tenant in tenants: - with tenant_context(tenant): - call_command( - "flush", - verbosity=0, - interactive=False, - database='default', - reset_sequences=False, - allow_cascade=True, - inhibit_post_migrate=False, - ) + with tenant_context(FakeTenant('public')): + for tenant in tenants: + tenant.delete(force_drop=True) @pytest.fixture -- 2.36.1