views:

310

answers:

1

I'm using Django 1.1 beta and hoping to use admin actions. I have to write unit tests for those, but I don't get it how to write tests for them.

For normal view handler functions, I can use Django's TestClient to simulate http request/response, but how should it be done with admin actions?

+1  A: 

Testing django admin is currently pain, because of admin's tight coupling. AFAIK, You can still use request/response, but I gave up and use only functional tests (Selenium, but you can use Windmill as well) and unit testing only our admin extensions.

There is a GSoC project for covering admin with Windmill tests, and windmill is now featuring plugin for Django integration.

If You're more interested in Selenium, I've written integration library for it, too (http://devel.almad.net/trac/django-sane-testing/).

Almad
I finally followed Django's internal test routines, http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/admin_views/tests.py#L1018 . I've already known Selenium, but not Windmill. Thanks for information. :)
Achimnol