1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 00:46:18 +00:00

Move a ListenBrainz test to the net suite

Allow to uncomment it and slightly improves coverage
This commit is contained in:
Alban Féron 2024-04-01 12:33:57 +02:00
parent 8d3a31d012
commit 1cfca94109
No known key found for this signature in database
GPG Key ID: 8CE0313646D16165
2 changed files with 15 additions and 12 deletions

View File

@ -255,18 +255,6 @@ class UserTestCase(FrontendTestBase):
rv = self.client.get("/user/me/lastfm/unlink", follow_redirects=True)
self.assertIn("Unlinked", rv.data)
def test_listenbrainz_link(self):
self._login("alice", "Alic3")
rv = self.client.get("/user/me/listenbrainz/link", follow_redirects=True)
self.assertIn("Missing ListenBrainz auth token", rv.data)
# # Testing this requires an HTTP request!
# rv = self.client.get(
# "/user/me/listenbrainz/link",
# query_string={"token": "abcdef"},
# follow_redirects=True,
# )
# self.assertIn("Error: ", rv.data)
def test_listenbrainz_unlink(self):
self._login("alice", "Alic3")
rv = self.client.get("/user/me/listenbrainz/unlink", follow_redirects=True)

View File

@ -11,6 +11,8 @@ import unittest
from supysonic.listenbrainz import ListenBrainz
from ..frontend.frontendtestbase import FrontendTestBase
class ListenBrainzTestCase(unittest.TestCase):
"""Basic test of unauthenticated ListenBrainz API method"""
@ -22,5 +24,18 @@ class ListenBrainzTestCase(unittest.TestCase):
rv = listenbrainz._ListenBrainz__api_request(False, "/1/search/users/?search_term={0}".format(user), token="123")
self.assertIsInstance(rv, dict)
class FrontendListenBrainzCase(FrontendTestBase):
def test_listenbrainz_link(self):
self._login("alice", "Alic3")
rv = self.client.get("/user/me/listenbrainz/link", follow_redirects=True)
self.assertIn("Missing ListenBrainz auth token", rv.data)
rv = self.client.get(
"/user/me/listenbrainz/link",
query_string={"token": "abcdef"},
follow_redirects=True,
)
self.assertIn("Error: ", rv.data)
if __name__ == "__main__":
unittest.main()