Exemplo n.º 1
0
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()
Exemplo n.º 2
0
def music():

    mood = request.form.get('mood')
    music = get_music(mood)
    # Store the mood in the session so we don't need to send it up all the time
    session['mood'] = mood
    print '$$$$$$$$$$$$$$$$$$$$ music done $$$$$$$$$$$$$$$$$$$'

    return render_template('music.html', music=music)
Exemplo n.º 3
0
def music():
    print " ENTERING /MUSIC ROUTE"
    mood = request.form.get('mood')
    music = get_music(mood)

    # Store the mood in the session so we don't need to send it up all the time
    session['mood'] = mood

    return render_template('music.html', music=music)
Exemplo n.º 4
0
def music_api():

    offset = request.form.get('offset')
    mood = session.get('mood')

    # We can skip arguments with defaults - we don't need to supply 'limit'
    # but we do need to specify that the thing we're sending is 'offset'

    music = get_music(mood, offset=offset)

    return jsonify({'playlists': music}) # you can't just jsonify a list
Exemplo n.º 5
0
def music_api():
    print "***********ENTERING API/MUSIC ROUTE ********** "
    offset = request.form.get('offset')
    mood = session.get('mood')

    # We can skip arguments with defaults - we don't need to supply 'limit'
    # but we do need to specify that the thing we're sending is 'offset'

    music = get_music(mood, offset=offset)
    print " HERE 'S the RESULTS "
    print music
    print

    return jsonify({'playlists': music}) # you can't just jsonify a list
Exemplo n.º 6
0
def test_get_limit():
    # test that if we have a limit of 20 we get 20 results
    result = get_music("happy", limit=20)
    assert len(result) == 20
Exemplo n.º 7
0
def test_get_happy():
    result = get_music("happy")

    for playlist in result:
        # make sure every playlist has the word 'happy' in its name
        assert "happy" in playlist.get("name").lower()
Exemplo n.º 8
0
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