This Flask extension provides simple utilities for testing your forms in Flask application.
The installation is thanks to the Python Package Index and pip really simple.
$ pip install Flask-fillin
If you only can use easy_install than use
$ easy_install Flask-fillin
Flask-fillin requires to run some packages (they will be installed automatically if they not already installed):
- Flask
- lxml
from flask.ext.fillin import FormWrapper client = FlaskClient(flask_app, response_wrapper=FormWrapper) # form submission response = client.get('/page_with_form') response.form.fields['username'] = 'my username' response.form.fields['password'] = 'secret' response.form.fields['remember'] = True response.form.submit(client) # link navigation response = client.get('/page_with_links') response.link("#link-id").click(client) # underlying parsed html links = response.html.findall("a") # file upload with open("TestFile") as fh: response.form.files['file'] = fh response.form.submit(client)