Verified Commit f8675c60 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fixed failing tests

parent 14d5b0c6
Pipeline #9714 passed with stages
in 9 minutes and 41 seconds
...@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__) ...@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__)
class RedisClient(default.DefaultClient): class RedisClient(default.DefaultClient):
def get(self, key, default=None, version=None, client=None): def get(self, key, default=None, version=None, client=None):
try: try:
return super().get(key, default=None, version=None, client=None) return super().get(key, default=default, version=version, client=client)
except ValueError as e: except ValueError as e:
if "unsupported pickle protocol" in str(e): if "unsupported pickle protocol" in str(e):
# pickle deserialization error # pickle deserialization error
......
import collections
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from rest_framework import renderers from rest_framework import renderers
...@@ -40,7 +41,7 @@ def structure_payload(data): ...@@ -40,7 +41,7 @@ def structure_payload(data):
payload["error"] = {"code": 0, "message": payload.pop("detail")} payload["error"] = {"code": 0, "message": payload.pop("detail")}
if "error" in payload: if "error" in payload:
payload["status"] = "failed" payload["status"] = "failed"
return payload return collections.OrderedDict(sorted(payload.items(), key=lambda v: v[0]))
class SubsonicJSONRenderer(renderers.JSONRenderer): class SubsonicJSONRenderer(renderers.JSONRenderer):
......
...@@ -80,7 +80,7 @@ def test_xml_renderer_dict_to_xml(): ...@@ -80,7 +80,7 @@ def test_xml_renderer_dict_to_xml():
def test_xml_renderer(): def test_xml_renderer():
payload = {"hello": "world"} payload = {"hello": "world"}
expected = '<?xml version="1.0" encoding="UTF-8"?>\n<subsonic-response funkwhaleVersion="{}" status="ok" type="funkwhale" version="1.16.0" hello="world" xmlns="http://subsonic.org/restapi" />' # noqa expected = '<?xml version="1.0" encoding="UTF-8"?>\n<subsonic-response funkwhaleVersion="{}" hello="world" status="ok" type="funkwhale" version="1.16.0" xmlns="http://subsonic.org/restapi" />' # noqa
expected = expected.format(funkwhale_api.__version__).encode() expected = expected.format(funkwhale_api.__version__).encode()
renderer = renderers.SubsonicXMLRenderer() renderer = renderers.SubsonicXMLRenderer()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment