skip to navigation
skip to content

flea 7.3.4

Test WSGI applications

Package Documentation

Latest Version: 8.0.3

Flea is a library that helps you write functional tests for WSGI applications.

Flea uses CSS selectors and XPath to give you a simple but powerful tool to navigate and test the HTML responses generated by your WSGI web applications. Here’s an example of how easy it is to test a WSGI application:

>>> r = TestAgent(my_wsgi_app).get('/')
>>> print r.body
                <a href="/sign-in">sign in</a>
>>> r ='sign in')
>>> r = r("form#login-form").fill(
...     username = 'root',
...     password = 'secret',
... ).submit()
>>> assert 'login successful' in r.body


Version 7.3.4

  • Updated to require cssselect

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

Version 7.3.2

  • Fixed bug in fill method, which was not clearing checkbox elements

Version 7.3.1

  • Fixed bug in TestAgent.follow

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.
  • now takes an argument that selects links by their textual content, eg'view results'). If you want the old behaviour, you need to pass a second argument, eg'//a[.="view results"]', 'xpath').

Version 7.2.1

  • The value property now does the right thing with respect to checkbox and

    radio groups. For checkbox groups, .value will get/set a list of values corresponding to the selected checkboxes. For radio buttons, .value will get/set the selected radio button.

  • Fixed error following links containing a fragment identifier

Version 7.2.0

  • Added .reload and .new_session methods to TestAgent

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 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 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
File Type Py Version Uploaded on Size
flea-7.3.4.tar.gz (md5) Source 2012-09-13 24KB
  • Downloads (All Versions):
  • 65 downloads in the last day
  • 522 downloads in the last week
  • 2475 downloads in the last month