Hey:
     check the web.py api
     request(self, localpart='/', method='GET', data=None,
host='0.0.0.0:8080', headers=None, https=False, **kw)

2011/8/29 Otto <ottodel...@gmail.com>:
> Hi All, I'm new to python & webpy, and am trying to get a simple unit
> test running. I have separated the test and application code into two
> modules. Running the unit test gives me a 405 (Method not allowed).
> Surprisingly, if I put a breakpoint in GET or a print statement, GET
> is never getting called. Somewhere the trolley is going off the
> tracks, but I don't know where. Also, in Eclipse,
>
> Any help is gratefully appreciated.
>
> ========
> foo.py:
> ========
> import web
>
> urls = ('/foo/(.*)', 'foo')
> app = web.application(urls, globals())
>
> class foo():
>
>    def GET(self):
>        return "foo"
>
> if __name__ == "__main__": app.run()
>
> =======
> testFoo.py
> =======
> import unittest
> from foo import app
>
> class TestFoo(unittest.TestCase):
>
>    def testFooGet(self):
>        url = '/foo/1234'
>        response = app.request('GET', url)                 # in
> Eclipse, this line gives me "undefined variable from import: request"
>        self.assertEquals(response.status, '200 OK')
>
> if __name__ == "__main__":
>    unittest.main()
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web.py" group.
> To post to this group, send email to webpy@googlegroups.com.
> To unsubscribe from this group, send email to 
> webpy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/webpy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to