Skip to main content

Test WSGI applications using lxml

Project description

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/

Changelog

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flea-7.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file flea-7.tar.gz.

File metadata

  • Download URL: flea-7.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flea-7.tar.gz
Algorithm Hash digest
SHA256 3a314fafe9921e4d42c55b1fd3488172869b8d05b5dd1f2a8f8fa770a0d240a7
MD5 7582d738e125747dd2acf2038f044599
BLAKE2b-256 1706be9dc8fe8ba5fc74f199e9464464076551f620acb718c0023e42ab42056b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page