Hi everyone,
i can use some help here.
Im doing some unittesting for my app (yep i finally decided
to start
testing my code) and encountered a strange "bug".
basically, I follow the testing documentation and try to do
a get
request and then test the response context using something
similar to
this
self.assertEqual(len(response.context['customers']), 5)
the weird thing is that the above code works for a template
that DOES
NOT extends from another template.
when my template extends from another template
extends 'base.html'
then the code
self.assertEqual(len(response.context['customers']), 5)
will not work. It will give ValueError exception complaining
that list
indices must be integer.
closer investigation reveals that the response.context
dictionary is
somehow transformed into a list of 2 identical dictionary.
so instead I need to do something like this
self.assertEqual(len(response.context[0]['customers']), 5)
Im not sure what happened here. i could be doing some weird
stuff, or
a bug in my code or if this is the actual implementation
from Django
itself.
Thanks
Ronald
--~--~---------~--~----~------------~-------~--~----~
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
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|