Beispiel #1
0
def test_gets_order(conference, requests_mock):
    requests_mock.get(f"https://pretix/api/organizers/events/orders/ABC/",
                      json={"code": "ABC"})

    order = get_order(conference, "ABC")

    assert order["code"] == "ABC"
Beispiel #2
0
def test_return_none_when_404(conference, requests_mock):
    requests_mock.get(
        "https://pretix/api/organizers/base-pretix-organizer-id/events/base-pretix-event-id/orders/ABC/",
        status_code=404,
    )

    assert get_order(conference, "ABC") is None
Beispiel #3
0
def get_order(conference: Conference, code: str) -> Optional[PretixOrder]:
    data = pretix.get_order(conference, code)

    if data:
        return PretixOrder.from_data(data)