tests Module Documentation

Module contents

Submodules

tests.settings module

tests.test_backend module

tests.test_backend.test_backend_applies_attributes_when_set(monkeypatch, settings)[source]

If CAS_APPLY_ATTRIBUTES_TO_USER is set, make sure the attributes returned with the ticket are added to the User model.

tests.test_backend.test_backend_authentication_create_user_with_id_and_attributes(monkeypatch, django_user_model, settings)[source]

CAS_CREATE_USER_WITH_ID is True and the attributes are not provided.

Should raise ImproperlyConfigured exception

tests.test_backend.test_backend_authentication_create_user_with_id_and_no_id_provided(monkeypatch, django_user_model, settings)[source]

CAS_CREATE_USER_WITH_ID is True and the ‘id’ field is not in the attributes.

Should raise ImproperlyConfigured exception

tests.test_backend.test_backend_authentication_create_user_with_id_and_user_exists(monkeypatch, django_user_model, settings)[source]

If CAS_CREATE_USER_WITH_ID is True and and the User already exists, don’t create another user.

tests.test_backend.test_backend_authentication_creates_a_user_with_id_attribute(monkeypatch, django_user_model, settings)[source]

If CAS_CREATE_USER_WITH_ID is True and ‘id’ is in the attributes, use this field to get_or_create a User.

tests.test_backend.test_backend_authentication_creating_a_user(monkeypatch, django_user_model)[source]

Test the case where CAS authentication is creating a new user.

tests.test_backend.test_backend_authentication_do_not_create_user(monkeypatch, django_user_model, settings)[source]

Test the case where CAS authentication is not creating a new user.

tests.test_backend.test_backend_does_not_apply_attributes_by_default(monkeypatch)[source]

Test to make sure attributes returned from the provider are not assigned to the User model by default.

tests.test_backend.test_backend_for_existing_user(monkeypatch, django_user_model)[source]

Test the case where CAS authenticates an existing user.

tests.test_backend.test_backend_for_existing_user_no_request(monkeypatch, django_user_model)[source]

Test the case where CAS authenticates an existing user, but request argument is None.

tests.test_backend.test_backend_for_failed_auth(monkeypatch, django_user_model)[source]

Test CAS authentication failure.

tests.test_backend.test_backend_user_can_authenticate(monkeypatch, django_user_model)[source]

Test CAS authentication failure.

tests.test_backend.test_backend_user_can_authenticate_with_cas_username_attribute(monkeypatch, settings)[source]

Test CAS_USERNAME_ATTRIBUTE setting.

tests.test_backend.test_backend_user_can_authenticate_with_cas_username_attribute2(monkeypatch, settings)[source]

Test CAS_USERNAME_ATTRIBUTE setting.

tests.test_backend.test_backend_user_can_map_cas_affils(monkeypatch, settings)[source]

Test CAS_MAP_AFFILIATIONS setting.

tests.test_backend.test_boolean_attributes_applied_as_booleans(monkeypatch, settings)[source]

If CAS_CREATE_USER_WITH_ID is True and ‘id’ is in the attributes, use this field to get_or_create a User.

tests.test_backend.test_cas_attributes_renaming_working(monkeypatch, settings)[source]

Test to make sure attributes are renamed according to the setting file

tests.test_commands module

Tests for the management commands

tests.test_commands.test_command_clean_session(django_user_model)[source]

tests.test_middleware module

tests.test_middleware.test_root_as_cas_admin_prefix_with_cas_login(monkeypatch, settings)[source]
tests.test_middleware.test_root_as_cas_admin_prefix_with_cas_logout(monkeypatch, settings)[source]

tests.test_signals module

tests.test_signals.test_signal_not_fired_if_auth_fails(monkeypatch, django_user_model)[source]

Test that the cas_user_authenticated signal is not fired when CAS authentication fails.

tests.test_signals.test_signal_when_user_already_exists(monkeypatch, django_user_model)[source]

Test that when CAS authentication creates a user, the signal is called with created = False

tests.test_signals.test_signal_when_user_is_created(monkeypatch, django_user_model)[source]

Test that when CAS authentication creates a user, the signal is called with created = True

tests.test_signals.test_signal_when_user_logout_manual(monkeypatch, django_user_model)[source]
tests.test_signals.test_signal_when_user_logout_slo(monkeypatch, django_user_model, settings)[source]

tests.test_smoke module

tests.test_smoke.test_nothing_is_on_fire()[source]

tests.test_utils module

tests.test_utils.test_force_ssl_service_url(settings)[source]
tests.test_utils.test_params_redirect_url_preceeds_settings_redirect_url(settings)[source]
tests.test_utils.test_redirect_url_falls_back_to_cas_redirect_url_setting(settings)[source]
tests.test_utils.test_redirect_url_falls_back_to_http_referrer(settings)[source]
tests.test_utils.test_redirect_url_named_pattern(settings)[source]
tests.test_utils.test_redirect_url_named_pattern_without_referrer(settings)[source]
tests.test_utils.test_redirect_url_next_no_named_pattern(settings)[source]
tests.test_utils.test_redirect_url_referrer_no_named_pattern(settings)[source]
tests.test_utils.test_redirect_url_strips_domain_prefix(settings)[source]
tests.test_utils.test_redirect_url_with_url_as_get_parameter()[source]
tests.test_utils.test_service_url_avoids_next(settings)[source]
tests.test_utils.test_service_url_helper()[source]
tests.test_utils.test_service_url_helper_as_https()[source]
tests.test_utils.test_service_url_helper_with_redirect()[source]
tests.test_utils.test_service_url_preserves_query_parameters()[source]
tests.test_utils.test_service_url_root_proxied_as(settings)[source]
tests.test_utils.test_service_url_root_proxied_as_empty_string(settings)[source]

If the settings module has the attribute CAS_ROOT_PROXIED_AS but its value is an empty string (or another falsy value), we must make sure the setting is not considered while constructing the redirect url.

tests.test_utils.test_session_factory(settings)[source]

tests.test_views module

tests.test_views.process_request_for_middleware(request, middleware)[source]
tests.test_views.test_callback_create_pgt()[source]

Test the case where a pgt callback is used.

tests.test_views.test_callback_post_logout(django_user_model, settings)[source]

Test that when logout is from a callback

tests.test_views.test_clean_next_page(rf)[source]
tests.test_views.test_clean_next_page_invalid(rf)[source]
tests.test_views.test_clean_next_page_invalid_override(rf, settings)[source]
tests.test_views.test_is_local_url()[source]
tests.test_views.test_login_authenticate_and_create_user(monkeypatch, django_user_model, settings)[source]

Test the case where the login view authenticates a new user.

tests.test_views.test_login_authenticate_do_not_create_user(monkeypatch, django_user_model, settings)[source]

Test the case where the login view authenticates a user, but does not create a user based on the CAS_CREATE_USER setting.

tests.test_views.test_login_no_ticket()[source]

Test the case where we try to login with no ticket

tests.test_views.test_login_no_ticket_stores_default_next(settings)[source]

When there is no explicit next pointer, it gets stored in a cookie

tests.test_views.test_login_no_ticket_stores_explicit_next(settings)[source]

When there is an explicit next pointer, it gets stored in the cookie

tests.test_views.test_login_post_logout(django_user_model, settings)[source]

Test that when CAS authentication creates a user, the signal is called with created = True

tests.test_views.test_login_proxy_callback(monkeypatch, django_user_model, settings)[source]

Test the case where the login view has a pgtiou.

Test the case where the login view authenticates a new user and redirects them based on cookie.

tests.test_views.test_logout_completely(django_user_model, settings)[source]

Test the case where the user logs out.

tests.test_views.test_logout_not_completely(django_user_model, settings)[source]

Test the case where the user logs out, without the logout_completely flag.

tests.urls module

tests.urls.dummy_view()[source]