コード例 #1
0
def test_user_add(client):
    is_admin_route(client, reverse('admin_user_add'))

    client_login(client, is_admin=True)
    user_payload = payload_from_form(
        AddCompanyUserForm(instance=UserFactory.build()), prefix='user')
    payload = {**user_payload}

    response = client.post(reverse('admin_user_add'), payload)

    assert response.status_code == 302
    assert response.url == reverse('admin_users')
    assert len(mail.outbox) == 1
    assert mail.outbox[0].subject == 'Welkom'
    assert User.objects.count(
    ) == 2  # One is logged in user, other created user
コード例 #2
0
def test_users(client):
    is_admin_route(client, reverse('admin_users'))
コード例 #3
0
def test_companies(client):
    is_admin_route(client, reverse('admin_companies'))
コード例 #4
0
def test_door_devices(client):
    is_admin_route(client, reverse('admin_door_devices'))