def test_response_container_content_type(): app = flask.Flask(__name__) response = flask.Response(response='test response', content_type='text/plain') container = ResponseContainer(mimetype='application/json', response=response) with app.app_context(): headers = container.flask_response_object().headers content_types = [ value for key, value in headers.items() if key == 'Content-Type' ] assert len(content_types) == 1 assert content_types[0] == 'text/plain'
def add_song_playlist(): session['addSongID'] = connexion.request.args['sID'] resp = application.send_static_file('listPlayListsToAdd.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def search_songs_post(): session['title'] = connexion.request.form['title'] session['artist'] = connexion.request.form['artist'] resp = application.send_static_file('listSearchedSongs.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def my_song_edit(): session['songID'] = connexion.request.args['sID'] print session['songID'] resp = application.send_static_file('editSong.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def my_playlist_edit(): print connexion.request.args['pID'] session['playID'] = connexion.request.args['pID'] print session['playID'] resp = application.send_static_file('editPlayList.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def my_playlist_songs(): session.pop('playSongID', None) session['playSongID'] = connexion.request.args['id'] print session['playSongID'] logging.debug('{Business} BEGIN function my_playlist_songs') logging.debug( '{Business} BEGIN function my_playlist_songs*******************************' ) resp = application.send_static_file('listPlayListSongs.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def send_javascript(js_page_name): resp = connexion.send_from_directory('js', js_page_name) return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def create_playlist_view(): resp = application.send_static_file('createPlayList.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def create_song_view(): resp = application.send_static_file('uploadSong.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def search_songs(): resp = application.send_static_file('searchSongs.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def my_playlists(): resp = application.send_static_file('listPlayLists.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def register(): resp = application.send_static_file('register.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)
def edit_account_view(): resp = application.send_static_file('editAccount.html') return ResponseContainer(mimetype=resp.mimetype, data=resp.response, status_code=200, headers=resp.headers)