On Thu, Dec 18, 2008 at 10:32 AM, Mike Orr <[email protected]> wrote:
>
> On Thu, Dec 18, 2008 at 7:55 AM, Jorge Vargas <[email protected]> wrote:
>>
>> Hi, I'm writing unit tests and I was wondering if there is a way to
>> ask routes for all possible urls it can handle. if this is not, there
>> how hard will it be to implement? Ideally I want to mix this with
>> webtest so I can have a generic test that will tell me if all urls I'm
>> calling are ok, by ok I mean no 400 or 500 errors, I know this is
>> going to be harder for the POSTs but for all the GETs it should be a
>> nice addition to the testsuite.
>
> Routes can't do this.  You can create some other iterator that "know"
> about all valid URL.
>
> Part of the problem is that the internal route format isn't
> documented.  The bigger problem is that if a route path contains a
> variable, a string of any length could be substituted, so the number
> of potential URLs is at least 36**N, where N is the maximum URL length
> whatever that is.  And if you have a /{controller}/{action} route (as
> the default Pylons configuration does), then any two-component URL is
> valid.
>
I was afraid that will be the answer.

My current set of routes is a very simple, it's crud + some methods.
so I guess I'm not hitting the wall on the second, which now that you
point it out makes the 100% automatic approach invalid.

I guess I'll have to build the list a little bit more manually by
scanning for references to url_for and redirect in the code base, or
maybe build something "web spider like".

> --
> Mike Orr <[email protected]>
>
> >
>

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

Reply via email to