Skip to content

Instantly share code, notes, and snippets.

What would you like to do?


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 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.

Custom methods
  • 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.

Custom methods
  • find(what, flags='', flat=False)

    Use flat=True to disable regexp matching and use raw what 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment