thunderbird_accounts.authentication.tests

Classes

AccountsOIDCBackendTestCase([methodName])

AdminCreateUserTestCase([methodName])

AdminDeleteUserTestCase([methodName])

Tests the admin user delete action.

AdminUpdateUserTestcase([methodName])

Tests the admin's user update form.

IsReservedUnitTests([methodName])

SignUpViewTestcase([methodName])

class thunderbird_accounts.authentication.tests.AdminCreateUserTestCase(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class thunderbird_accounts.authentication.tests.AdminUpdateUserTestcase(methodName='runTest')[source]

Bases: TestCase

Tests the admin’s user update form. We’re mainly trying to make sure updates hit Keycloak as well.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class thunderbird_accounts.authentication.tests.AdminDeleteUserTestCase(methodName='runTest')[source]

Bases: TestCase

Tests the admin user delete action. This is just a function/unit test as there’s no form involved here.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_success(mock_requests: MagicMock, mock_delete_principal: MagicMock)

Tests the full deletion flow: 1. Delete the User model. 2. Send a delete request to Keycloak to remove their login. 3. Send a delete request to Stalwart to remove their email/inbox.

test_success_without_stalwart_account(mock_requests: MagicMock, mock_delete_principal: MagicMock)

Tests a partial deletion flow since the user does not have a Stalwart email/inbox setup. 1. Delete the User model. 2. Send a delete request to Keycloak to remove their login. 3. Make sure we didn’t send anything to Stalwart

class thunderbird_accounts.authentication.tests.AccountsOIDCBackendTestCase(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_update_user_dont_reset_services_admin_permissions()[source]

Testing update_user to make sure not including is_services_admin in claim will leave is_staff, and is_superuser fields alone.

test_update_active_user_doesnt_check_allowlist()[source]

Testing update_user to make sure not including is_services_admin in claim will leave is_staff, and is_superuser fields alone.

test_update_inactive_user_does_check_allowlist()[source]

Testing update_user to make sure not including is_services_admin in claim will leave is_staff, and is_superuser fields alone.

class thunderbird_accounts.authentication.tests.IsReservedUnitTests(methodName='runTest')[source]

Bases: TestCase

class thunderbird_accounts.authentication.tests.SignUpViewTestcase(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

get_messages(response)[source]

Little helper message to retrieve flash messages

test_success(mock_import_user: MagicMock)

Test that an unauthenticated user can sign-up if they’re in the allow list.

test_not_on_allowed_list(mock_import_user: MagicMock)

Test that a recovery email not on the allow list will ship them to the wait list

test_user_already_exists(mock_import_user: MagicMock)

Test that we check if a user exists before creating a user

test_passwords_are_empty(mock_import_user: MagicMock)

Test that we check if passwords exist

test_passwords_dont_match(mock_import_user: MagicMock)

Test that we check if passwords actually match

test_import_errors_propagate(mock_import_user: MagicMock)

Test to make sure keycloak import user errors propagate to the frontend via messages