Added test code to manage.py