Fix #573: Added "type: funkwhale" and "funkwhale-version" in Subsonic responses
This commit is contained in:
parent
a6264d7deb
commit
941f2f6677
4 changed files with 28 additions and 3 deletions
|
|
@ -1,13 +1,21 @@
|
|||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import funkwhale_api
|
||||
|
||||
from funkwhale_api.subsonic import renderers
|
||||
|
||||
|
||||
def test_json_renderer():
|
||||
data = {"hello": "world"}
|
||||
expected = {
|
||||
"subsonic-response": {"status": "ok", "version": "1.16.0", "hello": "world"}
|
||||
"subsonic-response": {
|
||||
"status": "ok",
|
||||
"version": "1.16.0",
|
||||
"type": "funkwhale",
|
||||
"funkwhale-version": funkwhale_api.__version__,
|
||||
"hello": "world",
|
||||
}
|
||||
}
|
||||
renderer = renderers.SubsonicJSONRenderer()
|
||||
assert json.loads(renderer.render(data)) == expected
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import pytest
|
|||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
import funkwhale_api
|
||||
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.subsonic import renderers, serializers
|
||||
|
|
@ -18,7 +20,12 @@ def test_render_content_json(db, api_client):
|
|||
url = reverse("api:subsonic-ping")
|
||||
response = api_client.get(url, {"f": "json"})
|
||||
|
||||
expected = {"status": "ok", "version": "1.16.0"}
|
||||
expected = {
|
||||
"status": "ok",
|
||||
"version": "1.16.0",
|
||||
"type": "funkwhale",
|
||||
"funkwhale-version": funkwhale_api.__version__,
|
||||
}
|
||||
assert response.status_code == 200
|
||||
assert json.loads(response.content) == render_json(expected)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue