diff --git a/supysonic/api/exceptions.py b/supysonic/api/exceptions.py index 46a2d28..401726b 100644 --- a/supysonic/api/exceptions.py +++ b/supysonic/api/exceptions.py @@ -3,7 +3,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2018-2019 Alban 'spl0k' Féron +# Copyright (C) 2018-2020 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -18,7 +18,7 @@ class SubsonicAPIException(HTTPException): def get_response(self, environ=None): rv = request.formatter.error(self.api_code, self.message) - rv.status_code = self.code + # rv.status_code = self.code return rv def __str__(self): @@ -122,5 +122,5 @@ class AggregateException(SubsonicAPIException): rv = request.formatter( "error", dict(code=list(codes)[0] if len(codes) == 1 else 0, error=errors) ) - rv.status_code = self.code + # rv.status_code = self.code return rv diff --git a/supysonic/api/unsupported.py b/supysonic/api/unsupported.py index dd46dfc..0a76c1f 100644 --- a/supysonic/api/unsupported.py +++ b/supysonic/api/unsupported.py @@ -3,7 +3,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2018 Alban 'spl0k' Féron +# Copyright (C) 2018-2020 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -21,7 +21,7 @@ methods = ( def unsupported(): - return GenericError("Not supported by Supysonic"), 501 + return GenericError("Not supported by Supysonic") for m in methods: diff --git a/tests/api/test_api_setup.py b/tests/api/test_api_setup.py index 55bc01a..9a91f15 100644 --- a/tests/api/test_api_setup.py +++ b/tests/api/test_api_setup.py @@ -51,13 +51,13 @@ class ApiSetupTestCase(TestBase): def __test_auth(self, method): # non-existent user rv = method("null", "null") - self.assertEqual(rv.status_code, 401) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="40"', rv.data) # user request with bad password rv = method("alice", "wrong password") - self.assertEqual(rv.status_code, 401) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="40"', rv.data) @@ -69,7 +69,7 @@ class ApiSetupTestCase(TestBase): def test_auth_basic(self): # No auth info rv = self.client.get("/rest/ping.view?c=tests") - self.assertEqual(rv.status_code, 400) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="10"', rv.data) @@ -77,7 +77,7 @@ class ApiSetupTestCase(TestBase): # Shouldn't accept 'enc:' passwords rv = self.__basic_auth_get("alice", "enc:" + hexlify("Alic3")) - self.assertEqual(rv.status_code, 401) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="40"', rv.data) @@ -158,14 +158,14 @@ class ApiSetupTestCase(TestBase): "/rest/getVideos.view", query_string={"u": "alice", "p": "Alic3", "c": "tests"}, ) - self.assertEqual(rv.status_code, 501) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="0"', rv.data) rv = self.client.post( "/rest/getVideos.view", data={"u": "alice", "p": "Alic3", "c": "tests"} ) - self.assertEqual(rv.status_code, 501) + self.assertEqual(rv.status_code, 200) self.assertIn('status="failed"', rv.data) self.assertIn('code="0"', rv.data)