mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 17:45:18 +02:00
Added API endpoint for listing public instance settings
This commit is contained in:
parent
0944ef2a07
commit
6152b3bb36
7 changed files with 69 additions and 1 deletions
22
api/tests/instance/test_preferences.py
Normal file
22
api/tests/instance/test_preferences.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from django.urls import reverse
|
||||
|
||||
from dynamic_preferences.api import serializers
|
||||
|
||||
|
||||
def test_can_list_settings_via_api(preferences, api_client):
|
||||
url = reverse('api:v1:instance:settings')
|
||||
all_preferences = preferences.model.objects.all()
|
||||
expected_preferences = {
|
||||
p.preference.identifier(): p
|
||||
for p in all_preferences
|
||||
if getattr(p.preference, 'show_in_api', False)}
|
||||
|
||||
assert len(expected_preferences) > 0
|
||||
|
||||
response = api_client.get(url)
|
||||
assert response.status_code == 200
|
||||
assert len(response.data) == len(expected_preferences)
|
||||
|
||||
for p in response.data:
|
||||
i = '__'.join([p['section'], p['name']])
|
||||
assert i in expected_preferences
|
Loading…
Add table
Add a link
Reference in a new issue