Exemplo n.º 1
0
def test_timepad_post_text(monkeypatch, description):
    timepad_response_event = dict(
        moderation_status="moderated",
        **description,
    )

    def get(*args, **kwargs):
        return Response(ok=True, json_items=timepad_response_event)

    monkeypatch.setattr(requests, "get", get)

    tags = ("post_text", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.post_text == "test"
Exemplo n.º 2
0
def test_timepad_price(monkeypatch, ticket_type, answ, is_registration_open):
    timepad_response_event = dict(
        moderation_status="moderated",
        registration_data=dict(
            price_min=2,
            price_max=2,
        ),
        ticket_types=[ticket_type],
    )
    timepad_response_event["registration_data"][
        "is_registration_open"] = is_registration_open

    def get(*args, **kwargs):
        return Response(ok=True, json_items=timepad_response_event)

    monkeypatch.setattr(requests, "get", get)
    tags = ("price", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.price == answ
Exemplo n.º 3
0
def test_timepad_event_statuses():
    assert Timepad().event_statuses
Exemplo n.º 4
0
def test_timepad_event_catogories():
    assert Timepad().event_categories
Exemplo n.º 5
0
def test_timepad_token_in_environ():
    assert "TIMEPAD_TOKEN" in os.environ
    Timepad()
Exemplo n.º 6
0
def test_timepad_get_events_not_moderated(requests_get_events_not_moderated):
    assert len(Timepad().get_events()) == 1
Exemplo n.º 7
0
def test_timepad_get_event_without_args(requests_get_event):
    with pytest.raises(ValueError):
        Timepad().get_event()
Exemplo n.º 8
0
def test_timepad_get_event_by_url(requests_get_event):
    Timepad().get_event(event_url="https://test.test/event/12345/")
Exemplo n.º 9
0
def test_timepad_date_to(requests_get_event_date_to):
    tags = ("date_to", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert isinstance(event.date_to, datetime)
Exemplo n.º 10
0
def test_timepad_adress_city4(requests_get_event_adress_city4):
    tags = ("adress", )

    with pytest.raises(TypeError):
        Timepad().get_event(event_id=12345, tags=tags)
Exemplo n.º 11
0
def test_timepad_adress_city3(requests_get_event_adress_city3):
    tags = ("adress", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.adress == "1, 1"
Exemplo n.º 12
0
def test_timepad_token_without(remove_token):
    with pytest.raises(ValueError):
        Timepad()
Exemplo n.º 13
0
def test_timepad_adress_city1(requests_get_event_adress_city1):
    tags = ("adress", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.adress == "Санкт-Петербург"
Exemplo n.º 14
0
def test_timepad_adress(requests_get_event_adress):
    tags = ("adress", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.adress == "test_address, м.test subway"
Exemplo n.º 15
0
def test_timepad_ticket_statuses():
    assert Timepad().tickets_statuses
Exemplo n.º 16
0
def test_timepad_get_event_by_id(requests_get_event):
    Timepad().get_event(event_id=12345)
Exemplo n.º 17
0
def test_timepad_token_in_args():
    assert "TIMEPAD_TOKEN" in os.environ
    token = os.environ.get("TIMEPAD_TOKEN")
    Timepad(token=token)
Exemplo n.º 18
0
def test_timepad_get_event_with_tags(requests_get_event):
    tags = ("adress", "category")
    event = Timepad().get_event(event_id=12345, tags=tags)
    assert event._fields == tags
Exemplo n.º 19
0
def test_timepad_poster_imag(requests_get_event_poster_imag):
    tags = ("poster_imag", )
    event = Timepad().get_event(event_id=12345, tags=tags)

    assert event.poster_imag == "test_image"
Exemplo n.º 20
0
def test_timepad_get_event_not_moderated(requests_get_event_not_moderated):
    assert Timepad().get_event(event_id=12345) is None
Exemplo n.º 21
0
def test_timepad_get_events(requests_get_events):
    assert len(Timepad().get_events()) == 1