Flea helps you test WSGI applications without starting up an HTTP server.
If you already know lxml, you'll know what makes flea so powerful. Flea is fully integrated with lxml's xpath api, letting you 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()
Full package documentation: http://packages.python.org/flea/
What is new in this release:
- Added a fill_sloppy method that doesn't raise an exception when fields don't exist
What is new in version 7.4.1:
- Bugfix: Fixed error in TestAgent.serve()
- Improved unicode handling for WSGI environ values
What is new in version 7.4.0:
- Switch to fresco from pesto
- Experimental Python 3 support
- Bugfix: ensure WSGI response iterator's close method is always called
What is new in version 7.3.3:
- Included logging facility to allow easy tracing of calls to the application under test
- Added a flea.testing WSGI environ key so that the AUT can tell when it is running in a test environment
- Fixed a bug in post_multipart that caused an error when passing a data dict
What is new in version 7.3.1:
- Fixed bug in TestAgent.follow
What is new in version 7.3.0:
- New API for form filling, with each control type having a fill method. The value attribute is no longer overloaded.
- You can now traverse the DOM by calling the TestAgent object directly with either a CSS selector or XPath expression.
- TestAgent.click() now takes an argument that selects links by their textual content, eg agent.click('view results'). If you want the old behaviour, you need to pass a second argument, eg agent.click('//a[.="view results"]', 'xpath').
What is new in version 7.2.0:
- Added .reload and .new_session methods to TestAgent
What is new in version 7.1.1:
- Fixed check_status argument not being accepted in get, post, click, submit etc methods
What is new in 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 >
Requirements:
- Python
Comments not found