Projet

Général

Profil

0001-tests-don-t-use-call_command-tenant_command-command-.patch

Frédéric Péters, 13 août 2018 12:15

Télécharger (2,04 ko)

Voir les différences:

Subject: [PATCH 1/2] tests: don't use call_command('tenant_command',
 <command>...) (#25657)

https://github.com/bernardopires/django-tenant-schemas/issues/495
 tests_authentic/test_provisionning.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests_authentic/test_provisionning.py
450 450
                                                 entity_id='http://provider.com',
451 451
                                                 protocol_conformance=lasso.PROTOCOL_SAML_2_0)
452 452
    with patch('hobo.agent.authentic2.provisionning.notify_agents') as notify_agents:
453
        call_command('tenant_command', 'createsuperuser', domain=tenant.domain_url, uuid='coin',
453
        call_command('createsuperuser', domain=tenant.domain_url, uuid='coin',
454 454
                     username='coin', email='coin@coin.org', interactive=False)
455 455
        assert notify_agents.call_count == 1
456 456

  
......
470 470
                                last_name='Doe %s' % i, ou=ou,
471 471
                                email='jone.doe-%s@example.com')
472 472

  
473
    call_command('tenant_command', 'hobo_provision', domain=tenant.domain_url, roles=True, users=True)
473
    with tenant_context(tenant):
474
        # call_command('tenant_command', 'hobo_provision', ...) doesn't work
475
        # https://github.com/bernardopires/django-tenant-schemas/issues/495
476
        # so we call the command from the tenant context.
477
        call_command('hobo_provision', roles=True, users=True)
474 478

  
475 479
    msg_1 = notify_agents.call_args_list[0][0][0]
476 480
    msg_2 = notify_agents.call_args_list[1][0][0]
477
-