Re: Why two identical entries in django.test.utils.ContextList while testing?

2009-08-06 Thread ristretto.rb

Ah, that's it.  Thanks Karen.  What an awesome quick response.   My
mistake.

Thanks
gene


On Aug 7, 10:28 am, Karen Tracey  wrote:
> On Thu, Aug 6, 2009 at 5:41 PM, ristretto.rb  wrote:
>
> > Hello,
>
> > I'm working on some unit tests using the Client that comes with
> > subclassing django.test.TestCase.
>
> > When run code like this
>
> >  response = self.client.get("/project/usecase")
>
> > The object response.context is a list type object containing two
> > identical Dictionaries.
>
> The doc for this test response 
> attribute:http://docs.djangoproject.com/en/dev/topics/testing/#django.test.clie...
>
> notes that "If the rendered page used multiple templates, then context will
> be a list of Context objects, in the order in which they were rendered."
>
> So I expect your page used multiple templates?
>
> Karen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why two identical entries in django.test.utils.ContextList while testing?

2009-08-06 Thread Karen Tracey
On Thu, Aug 6, 2009 at 5:41 PM, ristretto.rb  wrote:

>
> Hello,
>
> I'm working on some unit tests using the Client that comes with
> subclassing django.test.TestCase.
>
> When run code like this
>
>  response = self.client.get("/project/usecase")
>
> The object response.context is a list type object containing two
> identical Dictionaries.


The doc for this test response attribute:
http://docs.djangoproject.com/en/dev/topics/testing/#django.test.client.Response.context

notes that "If the rendered page used multiple templates, then context will
be a list of Context objects, in the order in which they were rendered."



So I expect your page used multiple templates?

Karen

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Why two identical entries in django.test.utils.ContextList while testing?

2009-08-06 Thread ristretto.rb

Hello,

I'm working on some unit tests using the Client that comes with
subclassing django.test.TestCase.

When run code like this

  response = self.client.get("/project/usecase")

The object response.context is a list type object containing two
identical Dictionaries.  So, this errors ...

  self.assertTrue(response.context.has_key('blah'),"Blah not home.")

But, this works

  self.assertTrue(response.context[0].has_key('blah'),"Blah not
home.")

or this

  self.assertTrue(response.context[1].has_key('blah'),"Blah not
home.")

Not sure why there are two.  Any ideas?

thanks
Gene
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---