forked from jennielees/funky-music
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_spotify5.py
More file actions
34 lines (22 loc) · 810 Bytes
/
test_spotify5.py
File metadata and controls
34 lines (22 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
""" Simple testing for the Spotify functionality
so we don't need to click through pages to make
sure it's working.
Try this approach to running tests:
From the command-line, do both of these:
* pip install nose
* nosetests
nosetests automatically finds and runs tests in files starting with test_.
"""
from spotify import get_music
def test_get_happy():
result = get_music('happy', limit=1)
for playlist in result:
# make sure every playlist has the word 'happy' in its name
print playlist
assert 'happy' in playlist.get('name').lower()
def test_get_limit():
# test that if we have a limit of 20 we get 20 results
result = get_music('happy', limit=1)
assert len(result) == 1
if __name__ == "__main__":
test_get_happy()