@pytest.mark.django_db
def test_edit_user_view_preserves_ability_to_update_is_active(admin_client):
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = True
    user = UserFactory(**USER_DETAILS)
    user.is_active = False
    user.save()
    post_data = USER_DETAILS.copy()
    post_data.update(is_active='on')
    url = reverse('wagtailusers_users:edit', kwargs={'pk': user.pk})
    admin_client.post(url, data=post_data)
    user.refresh_from_db()
    assert (user.is_active is True)
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = False
    reload_urlconf()
@pytest.mark.django_db
def test_edit_user_view_preserves_ability_to_update_is_active(admin_client):
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = True
    user = UserFactory(**USER_DETAILS)
    user.is_active = False
    user.save()
    post_data = USER_DETAILS.copy()
    post_data.update(is_active='on')
    url = reverse('wagtailusers_users:edit', kwargs={'pk': user.pk})
    admin_client.post(url, data=post_data)
    user.refresh_from_db()
    assert (user.is_active is True)
    settings.FEATURE_FLAGS['ENFORCE_STAFF_SSO_ON'] = False
    reload_urlconf()