Moved tests to use Django test system.

Also added some database-related code, as LiveServerTestCase required it.

*All* tests will run now with django-admin.py test, including slow integration
tests. I'll want to eventually set a different command for integration and unit
tests.