From df2517c94c3ee1716edeea31d85547038e1ba02c Mon Sep 17 00:00:00 2001 From: sigma67 Date: Sun, 9 Apr 2023 21:24:23 +0200 Subject: [PATCH] add tests --- tests/test_cli.py | 1 + tests/test_spotipy.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 977afd1..0a7028d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,6 +35,7 @@ def test_create(self): with mock.patch("sys.argv", ["", "update", TEST_PLAYLIST, "test"]): main() + time.sleep(2) with mock.patch("sys.argv", ["", "remove", "test"]), mock.patch( "sys.stdout", new=StringIO() ) as fakeOutput, mock.patch("builtins.input", side_effect="y"): diff --git a/tests/test_spotipy.py b/tests/test_spotipy.py index e69de29..81c0190 100644 --- a/tests/test_spotipy.py +++ b/tests/test_spotipy.py @@ -0,0 +1,18 @@ +import unittest + +from spotify_to_ytmusic.spotify import Spotify + + +class TestSpotify(unittest.TestCase): + + def setUp(self) -> None: + self.spotify = Spotify() + + def test_getSpotifyPlaylist(self): + data = self.spotify.getSpotifyPlaylist("https://open.spotify.com/playlist/03ICMYsVsC4I2SZnERcQJb") + self.assertEqual(len(data), 3) + self.assertGreater(len(data["tracks"]), 190) + + def test_getUserPlaylists(self): + playlists = self.spotify.getUserPlaylists("spinninrecordsofficial") + self.assertGreater(len(playlists), 50)