On 1/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello djanonauts, I am writing unit tests for a project, and I would like to test my views. The documentation (http://www.djangoproject.com/documentation/testing/) suggests using django.test.client.Client to do the deed. When I use it in tests.py, it works fine, I can view the template and context properties of the HttpResponse. However, when I try to use Client interactively in the shell, template and context return None. Why is that? Is there a way to fix this problem?
Part of the setup performed by './manage.py test' is to add instrumentation to Django so that the test system can collect template rendering data. This instrumentation is not present by default; as a result, the test Client won't collect any template rendering data if you run it from the shell. If you want to use the test Client from the shell, you need to set up the test environment first, by running: from django.test.utils import setup_test_environment setup_test_environment() then run your tests. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

