@pytest.mark.django_db
def test_edit_user_view_cannot_change_personal_details_when_sso_enforced(admin_client):
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = True
    user = UserFactory(**USER_DETAILS)
    url = reverse('wagtailusers_users:edit', kwargs={'pk': user.pk})
    admin_client.post(url, data=USER_DETAILS_CHANGING)
    user.refresh_from_db()
    for (field_name, original_value) in USER_DETAILS.items():
        assert (getattr(user, field_name) == original_value)
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = False
    reload_urlconf()
@pytest.mark.django_db
def test_edit_user_view_cannot_change_personal_details_when_sso_enforced(admin_client):
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = True
    user = UserFactory(**USER_DETAILS)
    url = reverse('wagtailusers_users:edit', kwargs={'pk': user.pk})
    admin_client.post(url, data=USER_DETAILS_CHANGING)
    user.refresh_from_db()
    for (field_name, original_value) in USER_DETAILS.items():
        assert (getattr(user, field_name) == original_value)
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = False
    reload_urlconf()