On Sat, 2011-04-16 at 08:30 -0700, mdob wrote:
> Hi Chris,
> 
> 
> Thanks for answering.
> 
> 
> Lets assume the following:
> 
> 
> model = {'book':{'title':"Ender's Game", pages: 270,
> author:{'name':'Orson Scott Card', nationality:'American',
> 'genre':'sci-fi'}}}
> 
> 
> The root for traversal will be the model object.
> 
> 
> Path: /book/author/nationality
> 
> 
> We would like to test if the context returned is going to be the
> string "American".
> 
> 
> Conversely for the path of /book/author; the context should be a
> dictionary containing information on the Author.
> 
> 
> The documentation I found so far only describes complete functional
> test, which tests a result of a rendered view or individual unit test
> for each view. I am after testing a logic of the traversal of the
> model, which of course is more complex than the example above, hence
> the need for a test.

What you'd be testing with the sort of test I described (one that uses
"pyramid.traversal.traverse") is Pyramid's traversal code itself.
Pyramid already has reams and reams of test code for traversal
internally, so writing a test that makes sure traversal works may be at
the edge of diminishing returns.  Tests that might make more sense as a
unit test would be to test the  __getitem__ of each of your model
objects independently, so that when Pyramid does call them for you,
you're not surprised by the result.

- C




-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" 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/pylons-devel?hl=en.

Reply via email to