Example #1
0
def test_signature_check_middleware_admin_login(admin_client, settings):
    settings.MIDDLEWARE_CLASSES = SIGNATURE_CHECK_REQUIRED_MIDDLEWARE_CLASSES
    settings.FEATURE_ENFORCE_STAFF_SSO_ENABLED = True
    reload_urlconf()
    response = admin_client.get(reverse('admin:login'))

    assert response.status_code == 302
Example #2
0
def test_authenticated_user_middleware_no_user(client, settings):
    settings.MIDDLEWARE_CLASSES = SIGNATURE_CHECK_REQUIRED_MIDDLEWARE_CLASSES
    settings.FEATURE_ENFORCE_STAFF_SSO_ENABLED = True
    reload_urlconf()
    response = client.get(reverse('admin:login'))

    assert response.status_code == 302
    assert response.url == reverse('authbroker_client:login')
Example #3
0
def test_authenticated_user_middleware_authorised_no_staff(
        client, settings, admin_user):
    settings.MIDDLEWARE_CLASSES = SIGNATURE_CHECK_REQUIRED_MIDDLEWARE_CLASSES
    settings.FEATURE_ENFORCE_STAFF_SSO_ENABLED = True
    reload_urlconf()
    client.force_login(admin_user)

    response = client.get(reverse('admin:login'))

    assert response.status_code == 401