Hi, all,

I meet a strangely problem on django unit testing. I use django svn
version, the test code like this:

"""""""""""""""""""""""""""""""""""""""""""""""""""
from django.test import TestCase
...

class test(TestCase):
  ...
  def setUp(self):
    ...

  def test_template(self):
    # Test Templates for register
    response = self.client.get('/accounts/register/')
    self.assertTemplateUsed(response, "account/register.html")
    ...
"""""""""""""""""""""""""""""""""""""""""""""""""""

When I run unit test to test the class use:
  $ ./manage.py test apps.test

I'll get a failed info:
"""""""""""""""""""""""""""""""""""""""""""""""""""
F
======================================================================
FAIL:  test_template(apps.tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../apps/tests.py", line 486, in test_template
    self.assertTemplateUsed(response, "account/register.html")
  File ".../django/test/testcases.py", line 185, in assertTemplateUsed
    self.fail('No templates used to render the response')
AssertionError: No templates used to render the response
"""""""""""""""""""""""""""""""""""""""""""""""""""

but when I run unit test to test the failed function use:
  $ ./manage.py test apps.test.test_template
there will be ok:
"""""""""""""""""""""""""""""""""""""""""""""""""""
.
----------------------------------------------------------------------
Ran 1 test in 1.336s

OK
"""""""""""""""""""""""""""""""""""""""""""""""""""

and I use "print respone.context" to see the template context of
response,
when I test the class, it won't get nothing(the value of
respone.context is "None"), while I test the funtion, it will get a
correct value...

Any one can tell me that's why? Thank you so much!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to