From a171c7d41358b02b3a1859732318bb1fde82fcd7 Mon Sep 17 00:00:00 2001 From: ianb Date: Mon, 22 Aug 2005 21:11:50 +0000 Subject: Moved test --- tests/urlparser_data/__init__.py | 1 + tests/urlparser_data/deep/index.html | 1 + tests/urlparser_data/deep/sub/Main.txt | 1 + tests/urlparser_data/find_file/index.txt | 1 + tests/urlparser_data/find_file/test2.html | 1 + tests/urlparser_data/hook/__init__.py | 10 ++++++++++ tests/urlparser_data/hook/app.py | 5 +++++ tests/urlparser_data/hook/index.py | 4 ++++ tests/urlparser_data/not_found/__init__.py | 1 + tests/urlparser_data/not_found/recur/__init__.py | 9 +++++++++ tests/urlparser_data/not_found/recur/isfound.txt | 1 + tests/urlparser_data/not_found/simple/__init__.py | 3 +++ tests/urlparser_data/not_found/simple/found.txt | 1 + tests/urlparser_data/not_found/user/__init__.py | 12 ++++++++++++ tests/urlparser_data/not_found/user/list.py | 3 +++ tests/urlparser_data/python/__init__.py | 1 + tests/urlparser_data/python/simpleapp.py | 6 ++++++ tests/urlparser_data/python/stream.py | 7 +++++++ tests/urlparser_data/python/sub/__init__.py | 1 + tests/urlparser_data/python/sub/simpleapp.py | 6 ++++++ 20 files changed, 75 insertions(+) create mode 100644 tests/urlparser_data/__init__.py create mode 100644 tests/urlparser_data/deep/index.html create mode 100644 tests/urlparser_data/deep/sub/Main.txt create mode 100644 tests/urlparser_data/find_file/index.txt create mode 100644 tests/urlparser_data/find_file/test2.html create mode 100644 tests/urlparser_data/hook/__init__.py create mode 100644 tests/urlparser_data/hook/app.py create mode 100644 tests/urlparser_data/hook/index.py create mode 100644 tests/urlparser_data/not_found/__init__.py create mode 100644 tests/urlparser_data/not_found/recur/__init__.py create mode 100644 tests/urlparser_data/not_found/recur/isfound.txt create mode 100644 tests/urlparser_data/not_found/simple/__init__.py create mode 100644 tests/urlparser_data/not_found/simple/found.txt create mode 100644 tests/urlparser_data/not_found/user/__init__.py create mode 100644 tests/urlparser_data/not_found/user/list.py create mode 100644 tests/urlparser_data/python/__init__.py create mode 100644 tests/urlparser_data/python/simpleapp.py create mode 100644 tests/urlparser_data/python/stream.py create mode 100644 tests/urlparser_data/python/sub/__init__.py create mode 100644 tests/urlparser_data/python/sub/simpleapp.py (limited to 'tests/urlparser_data') diff --git a/tests/urlparser_data/__init__.py b/tests/urlparser_data/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/tests/urlparser_data/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/urlparser_data/deep/index.html b/tests/urlparser_data/deep/index.html new file mode 100644 index 0000000..8913442 --- /dev/null +++ b/tests/urlparser_data/deep/index.html @@ -0,0 +1 @@ +index2 diff --git a/tests/urlparser_data/deep/sub/Main.txt b/tests/urlparser_data/deep/sub/Main.txt new file mode 100644 index 0000000..ec42756 --- /dev/null +++ b/tests/urlparser_data/deep/sub/Main.txt @@ -0,0 +1 @@ +index3 diff --git a/tests/urlparser_data/find_file/index.txt b/tests/urlparser_data/find_file/index.txt new file mode 100644 index 0000000..6be29bc --- /dev/null +++ b/tests/urlparser_data/find_file/index.txt @@ -0,0 +1 @@ +index1 diff --git a/tests/urlparser_data/find_file/test2.html b/tests/urlparser_data/find_file/test2.html new file mode 100644 index 0000000..180cf83 --- /dev/null +++ b/tests/urlparser_data/find_file/test2.html @@ -0,0 +1 @@ +test2 diff --git a/tests/urlparser_data/hook/__init__.py b/tests/urlparser_data/hook/__init__.py new file mode 100644 index 0000000..9b1055c --- /dev/null +++ b/tests/urlparser_data/hook/__init__.py @@ -0,0 +1,10 @@ +from paste import wsgilib + +def urlparser_hook(environ): + first, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) + if not first: + # No username + return + environ['app.user'] = first + environ['SCRIPT_NAME'] += '/' + first + environ['PATH_INFO'] = rest diff --git a/tests/urlparser_data/hook/app.py b/tests/urlparser_data/hook/app.py new file mode 100644 index 0000000..d2714e5 --- /dev/null +++ b/tests/urlparser_data/hook/app.py @@ -0,0 +1,5 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/html')]) + return ['user: %s' % environ['app.user']] + + diff --git a/tests/urlparser_data/hook/index.py b/tests/urlparser_data/hook/index.py new file mode 100644 index 0000000..49e89f0 --- /dev/null +++ b/tests/urlparser_data/hook/index.py @@ -0,0 +1,4 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/html')]) + return ['index: %s' % environ['app.user']] + diff --git a/tests/urlparser_data/not_found/__init__.py b/tests/urlparser_data/not_found/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/tests/urlparser_data/not_found/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/urlparser_data/not_found/recur/__init__.py b/tests/urlparser_data/not_found/recur/__init__.py new file mode 100644 index 0000000..48205a5 --- /dev/null +++ b/tests/urlparser_data/not_found/recur/__init__.py @@ -0,0 +1,9 @@ +def not_found_hook(environ, start_response): + urlparser = environ['paste.urlparser.not_found_parser'] + path = environ.get('PATH_INFO', '') + if not path: + return urlparser.not_found(environ, start_response) + # Strip off leading _'s + path = '/' + path.lstrip('/').lstrip('_') + environ['PATH_INFO'] = path + return urlparser(environ, start_response) diff --git a/tests/urlparser_data/not_found/recur/isfound.txt b/tests/urlparser_data/not_found/recur/isfound.txt new file mode 100644 index 0000000..c8b8fab --- /dev/null +++ b/tests/urlparser_data/not_found/recur/isfound.txt @@ -0,0 +1 @@ +is found diff --git a/tests/urlparser_data/not_found/simple/__init__.py b/tests/urlparser_data/not_found/simple/__init__.py new file mode 100644 index 0000000..f1e7faa --- /dev/null +++ b/tests/urlparser_data/not_found/simple/__init__.py @@ -0,0 +1,3 @@ +def not_found_hook(environ, start_response): + start_response('200 OK', [('Content-type', 'text/plain')]) + return ['not found'] diff --git a/tests/urlparser_data/not_found/simple/found.txt b/tests/urlparser_data/not_found/simple/found.txt new file mode 100644 index 0000000..c8b8fab --- /dev/null +++ b/tests/urlparser_data/not_found/simple/found.txt @@ -0,0 +1 @@ +is found diff --git a/tests/urlparser_data/not_found/user/__init__.py b/tests/urlparser_data/not_found/user/__init__.py new file mode 100644 index 0000000..c47f88e --- /dev/null +++ b/tests/urlparser_data/not_found/user/__init__.py @@ -0,0 +1,12 @@ +from paste import wsgilib + +def not_found_hook(environ, start_response): + urlparser = environ['paste.urlparser.not_found_parser'] + first, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) + if not first: + # No username + return + environ['app.user'] = first + environ['SCRIPT_NAME'] += '/' + first + environ['PATH_INFO'] = rest + return urlparser(environ, start_response) diff --git a/tests/urlparser_data/not_found/user/list.py b/tests/urlparser_data/not_found/user/list.py new file mode 100644 index 0000000..f6228f0 --- /dev/null +++ b/tests/urlparser_data/not_found/user/list.py @@ -0,0 +1,3 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/plain')]) + return ['user: %s' % environ.get('app.user')] diff --git a/tests/urlparser_data/python/__init__.py b/tests/urlparser_data/python/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/tests/urlparser_data/python/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/urlparser_data/python/simpleapp.py b/tests/urlparser_data/python/simpleapp.py new file mode 100644 index 0000000..cbef9f1 --- /dev/null +++ b/tests/urlparser_data/python/simpleapp.py @@ -0,0 +1,6 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/html'), + ('test-header', 'TEST!')]) + return ['test1'] + + diff --git a/tests/urlparser_data/python/stream.py b/tests/urlparser_data/python/stream.py new file mode 100644 index 0000000..121b4d1 --- /dev/null +++ b/tests/urlparser_data/python/stream.py @@ -0,0 +1,7 @@ +def stream(): + def app(environ, start_response): + writer = start_response('200 OK', [('Content-type', 'text/html')]) + writer('te') + writer('st') + return ['2'] + return app diff --git a/tests/urlparser_data/python/sub/__init__.py b/tests/urlparser_data/python/sub/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/tests/urlparser_data/python/sub/__init__.py @@ -0,0 +1 @@ +# diff --git a/tests/urlparser_data/python/sub/simpleapp.py b/tests/urlparser_data/python/sub/simpleapp.py new file mode 100644 index 0000000..fd90966 --- /dev/null +++ b/tests/urlparser_data/python/sub/simpleapp.py @@ -0,0 +1,6 @@ +def application(environ, start_response): + start_response('200 OK', [('Content-type', 'text/html'), + ('test-header', 'TEST!')]) + return ['subsimple'] + + -- cgit v1.2.1