i see,  thanks jason and mike.
my testing senario:
there are many css resource in my application.i place these resource(a
correct url generated by url_for) in a dict,
for optimizing sake, i want merge these css into a single file than
cache it.so i need use urllib2.openurl function to get its content.
but urllib2.openurl need a absolute url,i give it by urlparse.urljoin
(request.application_url,a_css_url).

but i can't get any expectant content.

it's all.
maybe, i need a new idea.

thanks again.



On Sep 3, 12:35 am, Mike Orr <[email protected]> wrote:
> On Tue, Sep 1, 2009 at 11:20 PM, Jason S.<[email protected]> wrote:
>
> >> class TestAny(TestController):
>
> >>     def test_any(self):
> >>         """Tests to ensure that GET requests are prohibited"""
> >>         response = self.app.get(
> >>             url=url_for(controller='any', action='view', id= None)
> >>             )
> >>         print '-------------------------'
> >>         print response.req.application_url
> >>         print '-------------------------'
> >>         assert False # force print info
>
> > I don't think webtest.TestApp reads your server configuration at all.
>
> Correct.  The [server] section is only for "paster serve".
>
> > Based on my read of
> > the source, code, you can't even override it with extra_environ.
>
> Not sure where this is or whether it's a problem.
>
> > (pylons.url, which seems to be the replacement for url_for())
>
> Pylons is transitioning from url_for to pylons.url.
>
> > returns a path without a hostname, the port is being set to 80 by
> > default.
>
> > Try the following call instead, and the port should show up in
> > application_url:
>
> > response = self.app.get(
> >             url='http://localhost:5000'+url(controller='any',
> > action='view', id= None)
> >             )
>
> > That's clumsy to do on a regular basis. If you need it in all your
> > tests, you could write a function that constructs the hostname from
> > the config file. But do you really need the port # to be set for the
> > tests to work?
>
> True.  The basic purpose of functional tests is to make sure it
> responds correctly to the URL path, not the schema/host/port which is
> a server issue.  If you need to test those, you'd probably want
> another layer of tests outside the Pylons application.  Twill might be
> a good choice.
>
> --
> 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