mirror of
https://github.com/pretix/pretix.git
synced 2026-08-10 10:47:00 +00:00
API: Allow to filter events by testmode attribute
This commit is contained in:
@@ -137,6 +137,7 @@ Endpoints
|
||||
:query page: The page number in case of a multi-page result set, default is 1
|
||||
:query is_public: If set to ``true``/``false``, only events with a matching value of ``is_public`` are returned.
|
||||
:query live: If set to ``true``/``false``, only events with a matching value of ``live`` are returned.
|
||||
:query testmode: If set to ``true``/``false``, only events with a matching value of ``testmode`` are returned.
|
||||
:query has_subevents: If set to ``true``/``false``, only events with a matching value of ``has_subevents`` are returned.
|
||||
:query is_future: If set to ``true`` (``false``), only events that happen currently or in the future are (not) returned. Event series are never (always) returned.
|
||||
:query is_past: If set to ``true`` (``false``), only events that are over are (not) returned. Event series are never (always) returned.
|
||||
|
||||
@@ -72,7 +72,7 @@ with scopes_disabled():
|
||||
|
||||
class Meta:
|
||||
model = Event
|
||||
fields = ['is_public', 'live', 'has_subevents']
|
||||
fields = ['is_public', 'live', 'has_subevents', 'testmode']
|
||||
|
||||
def ends_after_qs(self, queryset, name, value):
|
||||
expr = (
|
||||
|
||||
@@ -158,6 +158,13 @@ def test_event_list(token_client, organizer, event):
|
||||
assert resp.status_code == 200
|
||||
assert [TEST_EVENT_RES] == resp.data['results']
|
||||
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/?testmode=true'.format(organizer.slug))
|
||||
assert resp.status_code == 200
|
||||
assert [] == resp.data['results']
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/?testmode=false'.format(organizer.slug))
|
||||
assert resp.status_code == 200
|
||||
assert [TEST_EVENT_RES] == resp.data['results']
|
||||
|
||||
resp = token_client.get('/api/v1/organizers/{}/events/?is_public=false'.format(organizer.slug))
|
||||
assert resp.status_code == 200
|
||||
assert [] == resp.data['results']
|
||||
|
||||
Reference in New Issue
Block a user