diff options
Diffstat (limited to 'docs/howto')
| -rw-r--r-- | docs/howto/windmill-tests.txt | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/docs/howto/windmill-tests.txt b/docs/howto/windmill-tests.txt index 08931d8a97..5445dc4de9 100644 --- a/docs/howto/windmill-tests.txt +++ b/docs/howto/windmill-tests.txt @@ -1,40 +1,38 @@ .. _howto-windmill-tests: Writing a Functional Tests with Windmill -======================================= +======================================== .. currentmodule:: django.test -If you need to provide custom file storage -- a common example is storing files -on some remote system -- you can do so by defining a custom storage class. -You'll need to follow these steps: +If you need to test overall behaviors of your site, ajax widgets or rendered +html, then functional tests are the solution. Django includes support for the +popular `Windmill`_ framework. Writing a windmill test +is simple, following these steps: -#. Your custom storage system must be a subclass of - ``django.core.files.storage.Storage``:: +.. _Windmill: http://getwindmill.com +#. Your windmill tests must be their own module, named ``wmtests`` or ``windmilltests``. + - from django.core.files.storage import Storage +#. Django must be able to run any function in the module without arguments. +:: + from windmill.conf import global_settings + ADMIN_URL = "%s/test_admin/admin" % global_settings.TEST_URL + from windmill.authoring import WindmillTestClient + from django.test.utils import calling_func_name - class MyStorage(Storage): - ... + def test_loginAndSetup(): + '''Mostly just a proof of concept to test working order of tests.''' + client = WindmillTestClient(calling_func_name()) -#. Django must be able to instantiate your storage system without any arguments. - This means that any settings should be taken from ``django.conf.settings``:: + client.open(url='http://localhost:8000/admin') + client.waits.forPageLoad(timeout=u'20000') + ... - from django.conf import settings - from django.core.files.storage import Storage - - class MyStorage(Storage): - def __init__(self, option=None): - if not option: - option = settings.CUSTOM_STORAGE_OPTIONS - ... - -#. Your storage class must implement the ``_open()`` and ``_save()`` methods, - along with any other methods appropriate to your storage class. See below for - more on these methods. - - In addition, if your class provides local file storage, it must override - the ``path()`` method. +#. Your windmill testing module must load any files other than the module loader + in ``__init__.py``. + :: + from primary.py import * Your custom storage system may override any of the storage methods explained in :ref:`ref-files-storage`, but you **must** implement the following methods: |
