Beispiel #1
0
 def test_from_artist(self):
     l = Link.from_artist(self.artist)
     self.assertEqual(str(l), "spotify:artist:test_artist")
Beispiel #2
0
 def test_from_playlist(self):
     l = Link.from_playlist(self.playlist)
     self.assertEqual(str(l), "spotify:playlist:test_playlist")
Beispiel #3
0
 def test_str(self):
     s = "str_test"
     l = Link.from_string(s)
     self.assertEqual(str(l), "link:str_test")
Beispiel #4
0
 def test_from_track(self):
     l2 = Link.from_track(self.track, 42 * 1000)
     self.assertEqual(str(l2), "spotify:track:test_track#00:42")
Beispiel #5
0
 def test_as_track_badlink(self):
     l = Link.from_string("NOTtrack:as_track_test")
     self.assertRaises(SpotifyError, l.as_track)
Beispiel #6
0
 def test_as_album_badlink(self):
     l = Link.from_string("NOTalbum:as_album_test")
     self.assertRaises(SpotifyError, l.as_album)
Beispiel #7
0
 def test_as_track_badlink(self):
     l = Link.from_string("NOTtrack:as_track_test")
     self.assertRaises(SpotifyError, l.as_track)
Beispiel #8
0
 def test_from_album(self):
     a = mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1)
     l2 = Link.from_album(a)
     self.assertEqual(str(l2), "link:album:bar")
Beispiel #9
0
 def test_type(self):
     t = mock_track("foo", 0,
                    mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1),
                    0, 0, 0, 0, 0, 1)
     l2 = Link.from_track(t, 42)
     self.assertEqual(l2.type(), Link.LINK_TRACK)
Beispiel #10
0
 def test_as_track(self):
     l = Link.from_string("track:as_track_test")
     t = l.as_track()
     self.assertEqual(str(t), "as_track_test")
Beispiel #11
0
 def test_from_playlist(self):
     p = mock_playlist("foo", [])
     l = Link.from_playlist(p)
     self.assertEqual(str(l), "link:playlist:foo")
Beispiel #12
0
 def test_from_search(self):
     s = mock_search("query")
     l2 = Link.from_search(s)
     self.assertEqual(str(l2), "link:search:query")
Beispiel #13
0
 def test_from_artist(self):
     a = mock_artist("artist", 1)
     l = Link.from_artist(a)
     self.assertEqual(str(l), "link:artist:artist")
Beispiel #14
0
 def test_as_track(self):
     l = Link.from_string("spotify:track:test_track")
     t = l.as_track()
     self.assertEqual(str(t), "track")
Beispiel #15
0
 def test_as_album(self):
     l = Link.from_string("album:as_album_test")
     t = l.as_album()
     self.assertEqual(str(t), "as_album_test")
Beispiel #16
0
 def test_as_artist(self):
     l = Link.from_string("spotify:artist:test_artist")
     a = l.as_artist()
     self.assertEqual(str(a), "artist")
Beispiel #17
0
 def test_as_album_badlink(self):
     l = Link.from_string("NOTalbum:as_album_test")
     self.assertRaises(SpotifyError, l.as_album)
Beispiel #18
0
 def test_as_track(self):
     l = Link.from_string("track:as_track_test")
     t = l.as_track()
     self.assertEqual(str(t), "as_track_test")
Beispiel #19
0
 def test_as_artist_badlink(self):
     l = Link.from_string("NOTartist:test_as_artist")
     self.assertRaises(SpotifyError, l.as_artist)
Beispiel #20
0
 def test_as_album(self):
     l = Link.from_string("album:as_album_test")
     t = l.as_album()
     self.assertEqual(str(t), "as_album_test")
Beispiel #21
0
 def test_str(self):
     s = "str_test"
     l = Link.from_string(s)
     self.assertEqual(str(l), "link:str_test")
Beispiel #22
0
 def test_as_artist_badlink(self):
     l = Link.from_string("NOTartist:test_as_artist")
     self.assertRaises(SpotifyError, l.as_artist)
Beispiel #23
0
 def test_from_track(self):
     t = mock_track("foo", 0, mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1), 0, 0, 0, 0, 0, 1)
     l2 = Link.from_track(t, 42)
     self.assertEqual(str(l2), "link:track:foo/42")
Beispiel #24
0
 def test_from_string(self):
     s = "spotify:artist:test"
     l = Link.from_string(s)
     self.assertEqual(str(l), "spotify:artist:test")
Beispiel #25
0
 def test_from_album(self):
     a = mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1)
     l2 = Link.from_album(a)
     self.assertEqual(str(l2), "link:album:bar")
Beispiel #26
0
 def test_from_album(self):
     l2 = Link.from_album(self.album)
     self.assertEqual(str(l2), "spotify:album:test_album")
Beispiel #27
0
 def test_from_artist(self):
     a = mock_artist("artist", 1)
     l = Link.from_artist(a)
     self.assertEqual(str(l), "link:artist:artist")
Beispiel #28
0
 def test_from_search(self):
     l2 = Link.from_search(self.search)
     self.assertEqual(str(l2), "spotify:search:query")
Beispiel #29
0
 def test_from_search(self):
     s = mock_search("query")
     l2 = Link.from_search(s)
     self.assertEqual(str(l2), "link:search:query")
Beispiel #30
0
 def test_type(self):
     l = Link.from_track(self.track, 0)
     self.assertEqual(l.type(), Link.LINK_TRACK)
Beispiel #31
0
 def test_from_playlist(self):
     p = mock_playlist("foo", [])
     l = Link.from_playlist(p)
     self.assertEqual(str(l), "link:playlist:foo")
Beispiel #32
0
 def test_as_album(self):
     l = Link.from_string("spotify:album:test_album")
     t = l.as_album()
     self.assertEqual(str(t), "album")
Beispiel #33
0
 def test_type(self):
     t = mock_track("foo", 0, mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1), 0, 0, 0, 0, 0, 1)
     l2 = Link.from_track(t, 42)
     self.assertEqual(l2.type(), Link.LINK_TRACK)
Beispiel #34
0
 def test_as_string(self):
     s = "spotify:track:str_test"
     l = Link.from_string(s)
     self.assertEqual(str(l), "spotify:track:str_test")
Beispiel #35
0
 def test_from_track(self):
     t = mock_track("foo", 0,
                    mock_album("bar", mock_artist("baz", 1), 0, "", 0, 1),
                    0, 0, 0, 0, 0, 1)
     l2 = Link.from_track(t, 42)
     self.assertEqual(str(l2), "link:track:foo/42")