I created custom django-admin commands
But, I don't know how to test it in standard django tests
I created custom django-admin commands
But, I don't know how to test it in standard django tests
You should make your actual command script the minimum possible, so that it just calls a function elsewhere. The function can then be tested via unit tests or doctests as normal.
I agree with Daniel that the actual command script should do the minimum possible but you can also test it directly in a Django unit test using os.popen4
.
From within your unit test you can have a command like
fin, fout = os.popen4('python manage.py yourcommand')
result = fout.read()
You can then analyze the contents of result to test whether your Django command was successful.