tests: don't use call_command('tenant_command', <command>...) (#25657)

https://github.com/bernardopires/django-tenant-schemas/issues/495
This commit is contained in:
Frédéric Péters 2018-08-13 12:06:29 +02:00
parent fec8dabd5f
commit 3189d84f06
1 changed files with 6 additions and 2 deletions

View File

@ -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]