summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianb <devnull@localhost>2008-05-29 02:37:13 +0000
committerianb <devnull@localhost>2008-05-29 02:37:13 +0000
commitd1a22b41987f251cf56179d4c96138769cecd328 (patch)
tree03cac127c239fca62d7da3f44dcdb1701a504e26
parente9bc5ae00d0a96b8d0d4161f4ed42b62eb4ab7e7 (diff)
downloadwebtest-d1a22b41987f251cf56179d4c96138769cecd328.tar.gz
sphinx-ify
-rw-r--r--docs/conf.py132
-rw-r--r--docs/index.txt24
-rw-r--r--docs/modules/webtest.txt30
-rwxr-xr-xregen-docs9
4 files changed, 186 insertions, 9 deletions
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..8eb2f0e
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+#
+# Paste documentation build configuration file, created by
+# sphinx-quickstart on Tue Apr 22 22:08:49 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default value; values that are commented out
+# serve to show the default value.
+
+import sys
+
+# If your extensions are in another directory, add it here.
+#sys.path.append('some/directory')
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.txt'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'WebTest'
+copyright = '2008, Ian Bicking'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '1.0'
+# The full version, including alpha/beta/rc tags.
+release = '1.0.1'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = ['include/contact.txt', 'include/reference_header.txt']
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'default.css'
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Content template for the index page.
+#html_index = ''
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'WebTestdoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+#latex_documents = []
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
diff --git a/docs/index.txt b/docs/index.txt
index 67bff8d..e61b4c6 100644
--- a/docs/index.txt
+++ b/docs/index.txt
@@ -3,6 +3,12 @@ Testing Applications with WebTest
:author: Ian Bicking <ianb@colorstudy.com>
+.. toctree::
+ :maxdepth: 3
+
+ license
+ modules/webtest
+
.. contents::
.. comment:
@@ -64,7 +70,7 @@ wrapper for WSGI applications. To use it, you simply instantiate it
with your WSGI application. (Note: if your WSGI application requires
any configuration, you must set that up manually in your tests.)
-.. code-block::
+.. code-block:: python
>>> from webtest import TestApp
>>> from webob import Request, Response
@@ -88,7 +94,7 @@ Making Requests
To make a request, use:
-.. code-block::
+.. code-block:: python
app.get('/path', [headers], [extra_environ], ...)
@@ -99,7 +105,7 @@ It has some additional methods to make it easier to test.
If you want to do a POST request, use:
-.. code-block::
+.. code-block:: python
app.post('/path', {'vars': 'values'}, [headers], [extra_environ],
[upload_files], ...)
@@ -127,13 +133,13 @@ The best way to simulate authentication is if your application looks
in ``environ['REMOTE_USER']`` to see if someone is authenticated.
Then you can simply set that value, like:
-.. code-block::
+.. code-block:: python
app.get('/secret', extra_environ=dict(REMOTE_USER='bob'))
If you want *all* your requests to have this key, do:
-.. code-block::
+.. code-block:: python
app = TestApp(my_app, extra_environ=dict(REMOTE_USER='bob'))
@@ -226,14 +232,14 @@ Form Submissions
You can fill out and submit forms from your tests. First you get the
form:
-.. code-block::
+.. code-block:: python
>>> res = app.get('/form.html')
>>> form = res.form
Then you fill it in fields:
-.. code-block::
+.. code-block:: python
>>> form.action
'/form-submit'
@@ -248,7 +254,7 @@ Then you fill it in fields:
Then you can submit. First we'll put up a simple test app to catch
the response:
-.. code-block::
+.. code-block:: python
>>> from webtest.debugapp import debug_app
>>> map_app['/form-submit'] = debug_app
@@ -293,7 +299,7 @@ them are required by WebTest), you will get an ImportError.
Examples:
-.. code-block::
+.. code-block:: python
>>> from webtest import TestResponse
>>> res = TestResponse(content_type='text/html', body='''
diff --git a/docs/modules/webtest.txt b/docs/modules/webtest.txt
new file mode 100644
index 0000000..988c99d
--- /dev/null
+++ b/docs/modules/webtest.txt
@@ -0,0 +1,30 @@
+:mod:`webtest` -- Functional Testing of Web Applications
+========================================================
+
+.. automodule:: webtest
+
+Module Contents
+---------------
+
+.. autoclass:: TestApp
+.. autoexception:: AppError
+
+Return Values
+~~~~~~~~~~~~~
+
+Some of the return values return instances of these classes:
+
+.. autoclass:: TestResponse
+.. autoclass:: TestRequest
+.. autoclass:: Form
+.. autoclass:: Field
+.. autoclass:: Select
+.. autoclass:: Radio
+.. autoclass:: Checkbox
+.. autoclass:: Text
+.. autoclass:: Textarea
+.. autoclass:: Hidden
+.. autoclass:: Submit
+
+
+
diff --git a/regen-docs b/regen-docs
new file mode 100755
index 0000000..e3786de
--- /dev/null
+++ b/regen-docs
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+mkdir -p docs/_static docs/_build
+sphinx-build -E -b html docs/ docs/_build || exit 1
+if [ "$1" = "publish" ] ; then
+ cd docs/
+ echo "Uploading files..."
+ scp -r _build/* ianb@webwareforpython.org:/home/paste/htdocs/webtest/
+fi