Пример #1
0
def test_removing_a_talk_fails_unless_grid_is_open():
    _set_global_settings(EventState.DOORS_OPEN)
    user = User.objects.create(username="******")
    talk = _create_talk(owner=user, title="A talk")

    with pytest.raises(ValueError):
        GridMutation.resolve_remove_talk(
            None,
            GraphQLInfo(user),
            slot_id=talk.slot.id,
        )
Пример #2
0
def test_removing_a_talk_fails_once_session_has_ended():
    _set_global_settings(EventState.GRID_OPEN)
    user = User.objects.create(username="******")
    talk = _create_talk(owner=user, title="A talk")
    talk.slot.session.start_time = datetime.now(tz=utc) - timedelta(hours=1)
    talk.slot.session.end_time = datetime.now(tz=utc) - timedelta(minutes=30)
    talk.slot.session.save()

    with pytest.raises(ValueError):
        GridMutation.resolve_remove_talk(
            None,
            GraphQLInfo(user),
            slot_id=talk.slot.id,
        )
Пример #3
0
def test_removing_a_talk_succeeds():
    _set_global_settings(EventState.GRID_OPEN)
    user = User.objects.create(username="******")
    talk = _create_talk(owner=user, title="A talk")

    slot = GridMutation.resolve_remove_talk(
        None,
        GraphQLInfo(user),
        slot_id=talk.slot.id,
    )

    with pytest.raises(Slot.talk.RelatedObjectDoesNotExist):
        assert slot.talk is None
    with pytest.raises(Talk.DoesNotExist):
        Talk.objects.get(id=talk.id)