bdd: Add a redirect-later page in webserver_sub.

This is needed for download tests.
This commit is contained in:
Florian Bruhin 2015-11-09 07:46:03 +01:00
parent 021ea444a1
commit 89c0ff0d9b

View File

@ -23,9 +23,11 @@ This script gets called as a QProcess from integration/conftest.py.
"""
import sys
import time
import os.path
from httpbin.core import app
from httpbin.structures import CaseInsensitiveDict
import flask
@ -41,6 +43,14 @@ def send_data(path):
return flask.send_from_directory(data_dir, path)
@app.route('/custom/redirect-later')
def redirect_later():
"""302 redirects to / after the given delay."""
args = CaseInsensitiveDict(flask.request.args.items())
time.sleep(int(args.get('delay', '1')))
return flask.redirect('/')
def main():
if hasattr(sys, 'frozen'):
basedir = os.path.realpath(os.path.dirname(sys.executable))