# SPDX-FileCopyrightText: 2020-present Tobias Kunze
# SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms

import pytest
from django_scopes import scope

from pretalx.person.rules import can_view_information


@pytest.mark.django_db
@pytest.mark.parametrize(
    "target_group,expected",
    (
        ("submitters", True),
        ("accepted", False),
        ("confirmed", False),
    ),
)
def test_can_view_information(information, submission, target_group, expected):
    with scope(event=submission.event):
        information.target_group = target_group
        information.save()
        assert (
            can_view_information(submission.speakers.first(), information) is expected
        )
