#NEWLINE# def test_track_addition( self ) : #NEWLINE# #INDENT# resp = self . post ( '/playlists/' , data = self . get_payload ( ) ) #NEWLINE# playlist_url = ( '/playlists/%s/' % resp . json [ 'id' ] ) #NEWLINE# add_url = ( '%sadd/' % playlist_url ) #NEWLINE# resp = self . post ( add_url , data = { #NEWLINE# #INDENT# 'track' : self . track . pk , #NEWLINE# 'index' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# nose . eq_ ( resp . status_code , 204 ) #NEWLINE# resp = self . post ( add_url , data = { #NEWLINE# #INDENT# 'track' : self . track . pk , #NEWLINE# 'index' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# nose . eq_ ( resp . status_code , 204 ) #NEWLINE# resp = self . post ( add_url , data = { #NEWLINE# #INDENT# 'track' : self . track . pk , #NEWLINE# 'index' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# nose . eq_ ( resp . status_code , 204 ) #NEWLINE# resp = self . post ( add_url , data = { #NEWLINE# #INDENT# 'track' : self . track . pk , #NEWLINE# 'index' : 2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# nose . eq_ ( resp . status_code , 204 ) #NEWLINE# resp = self . post ( add_url , data = { #NEWLINE# #INDENT# 'track' : self . track . pk , #NEWLINE# 'index' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# nose . eq_ ( resp . status_code , 204 ) #NEWLINE# resp = self . get ( playlist_url ) #NEWLINE# track = resp . json [ 'tracks' ] [ 0 ] #NEWLINE# nose . eq_ ( len ( resp . json [ 'tracks' ] ) , 5 ) #NEWLINE# nose . ok_ ( track . has_key ( 'id' ) ) #NEWLINE# nose . ok_ ( track . has_key ( 'uri' ) ) #NEWLINE# nose . ok_ ( track . has_key ( 'index' ) )