@pytest.mark.django_db
def test_ssorequestaccessview_shows_unlimited_visibilty_groups_only(admin_client, groups_with_info):
    url = reverse('sso:request_access')
    expected_choices = tuple(((g.id, g.info.name_singular) for g in groups_with_info))
    response = admin_client.get(url)
    group_field = response.context['form']['self_assigned_group'].field
    actual_choices = tuple(group_field.choices)
    assert (actual_choices == expected_choices)
    GroupInfo.objects.all().update(visibility=GroupInfo.VISIBILITY_MANAGERS_ONLY)
    response = admin_client.get(url)
    group_field = response.context['form']['self_assigned_group'].field
    assert (tuple(group_field.choices) == ())
@pytest.mark.django_db
def test_ssorequestaccessview_shows_unlimited_visibilty_groups_only(admin_client, groups_with_info):
    url = reverse('sso:request_access')
    expected_choices = tuple(((g.id, g.info.name_singular) for g in groups_with_info))
    response = admin_client.get(url)
    group_field = response.context['form']['self_assigned_group'].field
    actual_choices = tuple(group_field.choices)
    assert (actual_choices == expected_choices)
    GroupInfo.objects.all().update(visibility=GroupInfo.VISIBILITY_MANAGERS_ONLY)
    response = admin_client.get(url)
    group_field = response.context['form']['self_assigned_group'].field
    assert (tuple(group_field.choices) == ())