API: Allow to set seating_allow_blocked_seats_for_channel (Z#23159519) (#4333)

This commit is contained in:
Raphael Michel
2024-07-30 16:28:08 +02:00
committed by GitHub
parent bbc175d3d6
commit ad33785f4c
3 changed files with 30 additions and 1 deletions

View File

@@ -1274,6 +1274,7 @@ def test_get_event_settings(token_client, organizer, event):
)
assert resp.status_code == 200
assert resp.data['imprint_url'] == "https://example.org"
assert resp.data['seating_allow_blocked_seats_for_channel'] == []
resp = token_client.get(
'/api/v1/organizers/{}/events/{}/settings/?explain=true'.format(organizer.slug, event.slug),
@@ -1301,14 +1302,17 @@ def test_patch_event_settings(token_client, organizer, event):
}
],
'reusable_media_active': True, # readonly, ignored
'seating_allow_blocked_seats_for_channel': ['web']
},
format='json'
)
assert resp.status_code == 200
assert resp.data['imprint_url'] == "https://example.com"
assert resp.data['seating_allow_blocked_seats_for_channel'] == ['web']
assert not resp.data['reusable_media_active']
event.settings.flush()
assert event.settings.imprint_url == 'https://example.com'
assert event.settings.seating_allow_blocked_seats_for_channel == ['web']
assert not event.settings.reusable_media_active
assert event.all_logentries().filter(action_type="pretix.event.settings").count() == 1
@@ -1443,6 +1447,18 @@ def test_patch_event_settings_validation(token_client, organizer, event):
'cancel_allow_user_until': ['Invalid relative date']
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/settings/'.format(organizer.slug, event.slug),
{
'seating_allow_blocked_seats_for_channel': ['lolnope'],
},
format='json'
)
assert resp.status_code == 400
assert resp.data == {
'seating_allow_blocked_seats_for_channel': ['The value \"lolnope\" is not a valid sales channel.']
}
@pytest.mark.django_db
def test_patch_event_settings_file(token_client, organizer, event):