> 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.
In fact, the SERVER_PORT value it creates in the environ for the test
request is based entirely on the URL you pass in. Based on my read of
the source, code, you can't even override it with extra_environ. Since
url() (pylons.url, which seems to be the replacement for url_for())
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?

Jason
--~--~---------~--~----~------------~-------~--~----~
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