From 43c59116d542d630371eaa59388be18d62d678b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 13 Aug 2018 12:06:29 +0200 Subject: [PATCH 1/2] tests: don't use call_command('tenant_command', ...) (#25657) https://github.com/bernardopires/django-tenant-schemas/issues/495 --- tests_authentic/test_provisionning.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests_authentic/test_provisionning.py b/tests_authentic/test_provisionning.py index 62a44f9..685d65c 100644 --- a/tests_authentic/test_provisionning.py +++ b/tests_authentic/test_provisionning.py @@ -450,7 +450,7 @@ def test_provision_createsuperuser(transactional_db, tenant, caplog): entity_id='http://provider.com', protocol_conformance=lasso.PROTOCOL_SAML_2_0) with patch('hobo.agent.authentic2.provisionning.notify_agents') as notify_agents: - call_command('tenant_command', 'createsuperuser', domain=tenant.domain_url, uuid='coin', + call_command('createsuperuser', domain=tenant.domain_url, uuid='coin', username='coin', email='coin@coin.org', interactive=False) assert notify_agents.call_count == 1 @@ -470,7 +470,11 @@ def test_command_hobo_provision(notify_agents, transactional_db, tenant, caplog) last_name='Doe %s' % i, ou=ou, email='jone.doe-%s@example.com') - call_command('tenant_command', 'hobo_provision', domain=tenant.domain_url, roles=True, users=True) + with tenant_context(tenant): + # call_command('tenant_command', 'hobo_provision', ...) doesn't work + # https://github.com/bernardopires/django-tenant-schemas/issues/495 + # so we call the command from the tenant context. + call_command('hobo_provision', roles=True, users=True) msg_1 = notify_agents.call_args_list[0][0][0] msg_2 = notify_agents.call_args_list[1][0][0] -- 2.18.0