Utilities to test Django applications with nosetests and twill.
Base TestCase
in tddspry
. The main advantages with standart Python's unittest.TestCase
are that it depends object
and all functions from nose.tools existed as NoseTestCase
's methods.
tddspry.django
serves several custom TestCase
's for test your Django's applications.
Depends on NoseTestCase
. On setup
DatabaseTestCase
creates test sqlite3
database in :memory:
and on teardown
removes it.
- check_create(model, **kwargs)
- check_delete(instance)
- check_update(instance, **kwargs)
Depends on NoseTestCase
. On setup
HttpTestCase
creates test database via django.test.create_test_db
and on teardown
removes it.
Also this TestCase
consists of all twill functions as class methods.
find(what, flags='', flat=False)
Use
flat=True
to disable regexp matching and use rawwhat in html
expression.
More custom helpers for http tests you can find in Helpers section.
Also tddspry.django
gives several custom helpers to easying your http tests. To import it use:
from tddspry.django.helpers import *
List of helpers:
- go200(url)
- login(USERNAME, PASSWORD, login_url=settings.LOGIN_URL, form_id=1)
- login_to_admin(USERNAME, PASSWORD)
- logout(logout_url=settings.LOGOUT_URL)
- submit200()