|
Revision 1017
(checked in by fumanchu, 3 years ago)
|
Initial fix for #498 (Test suite assumes same process for client and server). All test modules now wrap the server-side code in a "setup_server" function. New test\modpy module (with several tests failing).
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
import test |
|---|
| 2 |
test.prefer_parent_path() |
|---|
| 3 |
|
|---|
| 4 |
import cherrypy |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
def setup_server(): |
|---|
| 8 |
class Root: |
|---|
| 9 |
def index(self): |
|---|
| 10 |
raise cherrypy.HTTPRedirect('dummy') |
|---|
| 11 |
index.exposed = True |
|---|
| 12 |
|
|---|
| 13 |
cherrypy.tree.mount(Root()) |
|---|
| 14 |
cherrypy.config.update({ |
|---|
| 15 |
'server.environment': 'production', |
|---|
| 16 |
'server.log_to_screen': False, |
|---|
| 17 |
'base_url_filter.on': True, |
|---|
| 18 |
'base_url_filter.base_url': 'http://www.mydomain.com' |
|---|
| 19 |
}) |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
import helper |
|---|
| 23 |
|
|---|
| 24 |
class BaseUrlFilterTest(helper.CPWebCase): |
|---|
| 25 |
|
|---|
| 26 |
def testBaseUrlFilter(self): |
|---|
| 27 |
self.getPage("/") |
|---|
| 28 |
self.assertHeader('Location', |
|---|
| 29 |
"http://www.mydomain.com%s/dummy" % self.prefix()) |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
if __name__ == '__main__': |
|---|
| 33 |
setup_server() |
|---|
| 34 |
helper.testmain() |
|---|