{% extends "base.html" %} {% block title %}Imprimatur{% endblock %} {% block nav %} Imprimatur {% endblock %} {% block content %}
To run an example test script save the following as a file:
[
{
'host': 'www.google.com',
'status_code': 200}]
then upload it using the form above, and it should come back saying all tests have passed. Here's another script with some more examples:
[
{
'name': "Single regex",
'port': 5000,
'host': "localhost",
'path': "/text_2",
'status_code': 200,
'regexes': ['inexhaustible']},
{
'name': "Basic auth",
'path': "/auth",
'auth': ("conrad", "kurtz"),
'status_code': 200},
{
'name': "File upload",
'path': "/echo",
'method': "post",
'files': {"yellow": "tests/2/crome-file.txt"},
'regexes': ["yellow", "on the leads"],
'status_code': 200},
{
'name': "Post name and value with regex.",
'path': "/echo",
'method': "post",
'data': {"quote": "Leisure is the mother of philosophy."},
'status_code': 200,
'regexes': ["Leisure"]},
{
'name': "Repeat until successful.",
'path': "/counter",
# 'max' is maximum number of times to try
# 'period' is the number of seconds to wait between tries
'tries': {'max': 3, 'period': 1},
'status_code': 200,
'regexes': ["The Decline And Fall Of The Roman Empire"]},
{
'name': "Regex on header.",
'path': "/redirect?location=http://localhost:5000/here.html",
'status_code': 302,
'regexes': ["here.html"]},
{
'name': "HTTP HEAD request.",
'path': "/text_1",
'method': "head",
'status_code': 200}]
The full list of properties for each request is given below. A * after the property name means that it is carried over to subsequent requests.
| Name | Notes |
|---|---|
| scheme* | Can be http (default) or https. |
| host* | Default is localhost. |
| port* | Default is 80. |
| auth* |
Sequence of username and password eg.
('conrad', 'kurtz').
|
| name | Used to label the request. |
| path |
End of the URL eg. /retrieve?product_id=45. Default is
/.
|
| method |
An HTTP method. eg. post. Default is get.
|
| data |
Dictionary of post values eg.
{'id': 45, 'name': 'agnez'}
|
| files |
File name and path to upload. Eg.
{'yellow': 'crome.txt'}
|
| tries |
Maximum number of times to try the URL. Default
{'max': 1, 'period': 1}. The
max value is the maximum number of times to try, and
the period is the number of seconds to wait between
tries.
|
| regexes |
Sequence of regular expressions eg.
[r'goths', r'vandals'].
|
| status_code | HTTP status code to check for, eg. 200 |