def test_queue_remove_unowned_track(self): other_user = self.create_test_user() other_user_client = app.test_client() # Log the 'other' user in other_user_client.post('/login', data={ 'username': other_user.username, 'password': other_user.username }, follow_redirects=True) track_to_add = self.random_sample_track() response = other_user_client.post( '/queue/add', data={'spotify_uri': track_to_add['file']}) response_data = json.loads(response.data) assert response.status_code == 200 assert response_data['status'] == 'ok' added_track = [ track for track in response_data['queue'] if track['spotify_url'] == track_to_add['file'] ][0] added_mpd_id = added_track['mpd_id'] response = self.app.post('/queue/remove', data={'track_id': added_mpd_id}) response_data = json.loads(response.data) assert response.status_code == 200 assert response_data['status'] != 'ok' assert response_data['status'] == 'error' assert 'You are not authorized' in response_data['message'] assert track_to_add in self.mpd.playlistinfo()
def test_queue_remove_unowned_track(self): other_user = self.create_test_user() other_user_client = app.test_client() # Log the 'other' user in other_user_client.post('/login', data = {'username': other_user.username, 'password': other_user.username}, follow_redirects = True) track_to_add = self.random_sample_track() response = other_user_client.post('/queue/add', data = {'spotify_uri': track_to_add['file']}) response_data = json.loads(response.data) assert response.status_code == 200 assert response_data['status'] == 'ok' added_track = [track for track in response_data['queue'] if track['spotify_url'] == track_to_add['file']][0] added_mpd_id = added_track['mpd_id'] response = self.app.post('/queue/remove', data = {'track_id': added_mpd_id}) response_data = json.loads(response.data) assert response.status_code == 200 assert response_data['status'] != 'ok' assert response_data['status'] == 'error' assert 'You are not authorized' in response_data['message'] assert track_to_add in self.mpd.playlistinfo()
def _setup(self): self.app = app.test_client()