Test WSGI applications using lxml
Project description
Flea helps you write functional tests for WSGI applications without needing to start an HTTP server.
Flea is fully integrated with lxml’s XPath api, making it easy to inspect, modify and navigate HTML documents returned from your WSGI application. Here’s an example session:
>>> agent = TestAgent(my_wsgi_app) >>> agent.get('/') >>> print agent.body <html> <body> <a href="/sign-in">sign in</a> </body> </html> >>> agent = agent["//a[.='sign in']"].click() >>> print agent.request.request_uri http://localhost/sign-in >>> agent["//input[@name='username']"].value = 'root' >>> agent["//input[@name='password']"].value = 'password' >>> agent = agent["//input[@type='submit']"].submit()
Changes
Version 7.1.1
Fixed check_status argument not being accepted in get, post, click, submit etc methods
Version 7.1.0
Added .fill - fill multiple form fields in a single call.
Added .show - show the current response in a web browser
Added .serve - start an HTTP server for the the application under test and open a browser at the current page
Added check for HTTP status success or redirect codes (2xx or 3xx), anything else raises an AssertionError by default
Changed default behaviour to follow HTTP redirects
Changed version numbering scheme to <major>.<minor>
Version 7
Fixed error when accessing the ‘checked’ property of an input box
Prevented raising of ValueError on non-matching xpaths when accessed by .find() (__getitem__ will however still raise an error).
Version 6
Requires pesto 16 or higher
Version 5
Updated setup.py for compatibility with pesto==15
Version 4
Added support for file upload fields
Allow TestAgent.get/post etc to take a relative URI as an argument
Version 3
Updated setup.py for compatibility with pesto==14
Version 2
EXSLT regular expression namespace is bound to re prefix by default, allowing regexps in xpath expressions.
Bug fixes for form element handling
Version 1
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.