Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Apr 9, 2023
1 parent 7cc08fa commit df2517c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
18 changes: 18 additions & 0 deletions tests/test_spotipy.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit df2517c

Please sign in to comment.