Personal tools
You are here: Home Plone XP leocornus.django.ploneproxy Unit Test for Django Application

Unit Test for Django Application

We have to do unit test for 2 different framework:

  • How to do unit test for a Django application?
    • unit test model
    • unit test backend
    • unit test middleware
  • How to unit test PythonAuthenHandler implementation?
    • need check document about mod_python...

Testing Django Application

It is quiet simple to do unit test for a Django application.  The manage tool has a test command to run all unit tests in a Django application.  Developers only need write either doctests or unit tests!

OperationalError: table "auth_group_permissions" already exists

I got this error when I try to test my Django application at first time!  It took me a couple of hours time to figure out the reason: I create a module (folder) called auth, which is the same name with default django.contrib.auth module.  And there is a model class in that module.  Then the syncdb command got confused and try to create the table auth_group_permissions again!  Don't know why it works like that.  But after I change the module name to something else, such as myauth, then no such error any more!

Tracking History

When Who What Done
2010-05-14 07:28 Sean Chen gave the first try to run test and change the module name to resolve the table already exists error! revision: r402
-- 1.5 Hours, 30.0% Done
Document Actions