webtest – Functional Testing of Web Applications
Routines for testing WSGI applications.
Most interesting is TestApp
Module Contents
-
class webtest.TestApp(app, extra_environ=None, relative_to=None)
-
exception webtest.AppError
Return Values
Some of the return values return instances of these classes:
-
class webtest.TestResponse(body=None, status=None, headerlist=None, app_iter=None, request=None, content_type=None, conditional_response=None, **kw)
- Instances of this class are return by TestApp
-
class webtest.TestRequest(environ=None, environ_getter=None, charset=(No Default), unicode_errors=(No Default), decode_param_names=(No Default), **kw)
-
class webtest.Form(response, text)
This object represents a form that has been found in a page.
This has a couple useful attributes:
- text:
- the full HTML of the form.
- action:
- the relative URI of the action.
- method:
- the method (e.g., 'GET').
- id:
- the id, or None if not given.
- fields:
- a dictionary of fields, each value is a list of fields by
that name. <input type="radio"> and <select> are
both represented as single fields with multiple options.
-
class webtest.Field(form, tag, name, pos, value=None, id=None, **attrs)
- Field object.
-
class webtest.Select(*args, **attrs)
- Field representing <select>
-
class webtest.Radio(*args, **attrs)
- Field representing <input type="radio">
-
class webtest.Checkbox(*args, **attrs)
- Field representing <input type="checkbox">
-
class webtest.Text(form, tag, name, pos, value=None, id=None, **attrs)
- Field representing <input type="text">
-
class webtest.Textarea(form, tag, name, pos, value=None, id=None, **attrs)
- Field representing <textarea>
-
class webtest.Hidden(form, tag, name, pos, value=None, id=None, **attrs)
- Field representing <input type="hidden">
-
class webtest.Submit(form, tag, name, pos, value=None, id=None, **attrs)
- Field representing <input type="submit"> and <button>