diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-08-22 21:11:50 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-08-22 21:11:50 +0000 |
commit | a4eff7dc0749019c4767f135be4103f6d777f2e8 (patch) | |
tree | df23a0f3712044eb1fbb6a1a8e665e69956df76e | |
parent | d2457459ada5e7f033c565fcc40c50bb52addb61 (diff) | |
download | paste-git-a4eff7dc0749019c4767f135be4103f6d777f2e8.tar.gz |
Moved test
-rw-r--r-- | tests/test_urlparser.py (renamed from paste/tests/test_urlparser.py) | 70 | ||||
-rw-r--r-- | tests/urlparser_data/__init__.py (renamed from paste/tests/urlparser_data/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/deep/index.html (renamed from paste/tests/urlparser_data/deep/index.html) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/deep/sub/Main.txt (renamed from paste/tests/urlparser_data/deep/sub/Main.txt) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/find_file/index.txt (renamed from paste/tests/urlparser_data/find_file/index.txt) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/find_file/test2.html (renamed from paste/tests/urlparser_data/find_file/test2.html) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/hook/__init__.py (renamed from paste/tests/urlparser_data/hook/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/hook/app.py (renamed from paste/tests/urlparser_data/hook/app.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/hook/index.py (renamed from paste/tests/urlparser_data/hook/index.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/__init__.py (renamed from paste/tests/urlparser_data/not_found/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/recur/__init__.py (renamed from paste/tests/urlparser_data/not_found/recur/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/recur/isfound.txt (renamed from paste/tests/urlparser_data/not_found/recur/isfound.txt) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/simple/__init__.py (renamed from paste/tests/urlparser_data/not_found/simple/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/simple/found.txt (renamed from paste/tests/urlparser_data/not_found/simple/found.txt) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/user/__init__.py (renamed from paste/tests/urlparser_data/not_found/user/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/not_found/user/list.py (renamed from paste/tests/urlparser_data/not_found/user/list.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/python/__init__.py (renamed from paste/tests/urlparser_data/python/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/python/simpleapp.py (renamed from paste/tests/urlparser_data/python/simpleapp.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/python/stream.py (renamed from paste/tests/urlparser_data/python/stream.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/python/sub/__init__.py (renamed from paste/tests/urlparser_data/python/sub/__init__.py) | 0 | ||||
-rw-r--r-- | tests/urlparser_data/python/sub/simpleapp.py (renamed from paste/tests/urlparser_data/python/sub/simpleapp.py) | 0 |
21 files changed, 32 insertions, 38 deletions
diff --git a/paste/tests/test_urlparser.py b/tests/test_urlparser.py index 0e1aa1a..292df0a 100644 --- a/paste/tests/test_urlparser.py +++ b/tests/test_urlparser.py @@ -1,83 +1,77 @@ import os from paste.urlparser import * -from fixture import fake_request +from paste.fixture import * def path(name): return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'urlparser_data', name) -def make_parser(name): - return URLParser(path(name), name, {'index_names': ['index', 'Main']}) +def make_app(name): + app = URLParser(path(name), name, {'index_names': ['index', 'Main']}) + testapp = TestApp(app) + return testapp def test_find_file(): - p = make_parser('find_file') - res = fake_request(p, '/') + app = make_app('find_file') + res = app.get('/') assert 'index1' in res assert res.header('content-type') == 'text/plain' - res = fake_request(p, '/index') + res = app.get('/index') assert 'index1' in res assert res.header('content-type') == 'text/plain' - res = fake_request(p, '/index.txt') + res = app.get('/index.txt') assert 'index1' in res assert res.header('content-type') == 'text/plain' - res = fake_request(p, '/test2.html') + res = app.get('/test2.html') assert 'test2' in res assert res.header('content-type') == 'text/html' def test_deep(): - p = make_parser('deep') - res = fake_request(p, '/') + app = make_app('deep') + res = app.get('/') assert 'index2' in res - res = fake_request(p, '/sub') - assert res.status_int == 301 + res = app.get('/sub') + assert res.status == 301 print res assert res.header('location') == 'http://localhost/sub/' assert 'href="http://localhost/sub/"' in res - res = fake_request(p, '/sub/') + res = app.get('/sub/') assert 'index3' in res def test_python(): - p = make_parser('python') - res = fake_request(p, '/simpleapp') - res.all_ok() + app = make_app('python') + res = app.get('/simpleapp') assert 'test1' in res assert res.header('test-header') == 'TEST!' assert res.header('content-type') == 'text/html' - res = fake_request(p, '/stream') - res.all_ok() + res = app.get('/stream') assert 'test2' in res - res = fake_request(p, '/sub/simpleapp') - res.all_ok() + res = app.get('/sub/simpleapp') assert 'subsimple' in res def test_hook(): - p = make_parser('hook') - res = fake_request(p, '/bob/app') - res.all_ok() + app = make_app('hook') + res = app.get('/bob/app') assert 'user: bob' in res - res = fake_request(p, '/tim/') - res.all_ok() + res = app.get('/tim/') assert 'index: tim' in res def test_not_found_hook(): - p = make_parser('not_found') - res = fake_request(p, '/simple/notfound') - assert res.status_int == 200 + app = make_app('not_found') + res = app.get('/simple/notfound') + assert res.status == 200 assert 'not found' in res - res = fake_request(p, '/simple/found') - res.all_ok() + res = app.get('/simple/found') assert 'is found' in res - res = fake_request(p, '/recur/__notfound') - assert res.status_int == 404 + res = app.get('/recur/__notfound', status=404) # @@: It's unfortunate that the original path doesn't actually show up assert '/recur/notfound' in res - res = fake_request(p, '/recur/__isfound') - assert res.status_int == 200 + res = app.get('/recur/__isfound') + assert res.status == 200 assert 'is found' in res - res = fake_request(p, '/user/list') - res.all_ok() + res = app.get('/user/list') assert 'user: None' in res - res = fake_request(p, '/user/bob/list') - assert res.status_int == 200 + res = app.get('/user/bob/list') + assert res.status == 200 assert 'user: bob' in res diff --git a/paste/tests/urlparser_data/__init__.py b/tests/urlparser_data/__init__.py index 792d600..792d600 100644 --- a/paste/tests/urlparser_data/__init__.py +++ b/tests/urlparser_data/__init__.py diff --git a/paste/tests/urlparser_data/deep/index.html b/tests/urlparser_data/deep/index.html index 8913442..8913442 100644 --- a/paste/tests/urlparser_data/deep/index.html +++ b/tests/urlparser_data/deep/index.html diff --git a/paste/tests/urlparser_data/deep/sub/Main.txt b/tests/urlparser_data/deep/sub/Main.txt index ec42756..ec42756 100644 --- a/paste/tests/urlparser_data/deep/sub/Main.txt +++ b/tests/urlparser_data/deep/sub/Main.txt diff --git a/paste/tests/urlparser_data/find_file/index.txt b/tests/urlparser_data/find_file/index.txt index 6be29bc..6be29bc 100644 --- a/paste/tests/urlparser_data/find_file/index.txt +++ b/tests/urlparser_data/find_file/index.txt diff --git a/paste/tests/urlparser_data/find_file/test2.html b/tests/urlparser_data/find_file/test2.html index 180cf83..180cf83 100644 --- a/paste/tests/urlparser_data/find_file/test2.html +++ b/tests/urlparser_data/find_file/test2.html diff --git a/paste/tests/urlparser_data/hook/__init__.py b/tests/urlparser_data/hook/__init__.py index 9b1055c..9b1055c 100644 --- a/paste/tests/urlparser_data/hook/__init__.py +++ b/tests/urlparser_data/hook/__init__.py diff --git a/paste/tests/urlparser_data/hook/app.py b/tests/urlparser_data/hook/app.py index d2714e5..d2714e5 100644 --- a/paste/tests/urlparser_data/hook/app.py +++ b/tests/urlparser_data/hook/app.py diff --git a/paste/tests/urlparser_data/hook/index.py b/tests/urlparser_data/hook/index.py index 49e89f0..49e89f0 100644 --- a/paste/tests/urlparser_data/hook/index.py +++ b/tests/urlparser_data/hook/index.py diff --git a/paste/tests/urlparser_data/not_found/__init__.py b/tests/urlparser_data/not_found/__init__.py index 792d600..792d600 100644 --- a/paste/tests/urlparser_data/not_found/__init__.py +++ b/tests/urlparser_data/not_found/__init__.py diff --git a/paste/tests/urlparser_data/not_found/recur/__init__.py b/tests/urlparser_data/not_found/recur/__init__.py index 48205a5..48205a5 100644 --- a/paste/tests/urlparser_data/not_found/recur/__init__.py +++ b/tests/urlparser_data/not_found/recur/__init__.py diff --git a/paste/tests/urlparser_data/not_found/recur/isfound.txt b/tests/urlparser_data/not_found/recur/isfound.txt index c8b8fab..c8b8fab 100644 --- a/paste/tests/urlparser_data/not_found/recur/isfound.txt +++ b/tests/urlparser_data/not_found/recur/isfound.txt diff --git a/paste/tests/urlparser_data/not_found/simple/__init__.py b/tests/urlparser_data/not_found/simple/__init__.py index f1e7faa..f1e7faa 100644 --- a/paste/tests/urlparser_data/not_found/simple/__init__.py +++ b/tests/urlparser_data/not_found/simple/__init__.py diff --git a/paste/tests/urlparser_data/not_found/simple/found.txt b/tests/urlparser_data/not_found/simple/found.txt index c8b8fab..c8b8fab 100644 --- a/paste/tests/urlparser_data/not_found/simple/found.txt +++ b/tests/urlparser_data/not_found/simple/found.txt diff --git a/paste/tests/urlparser_data/not_found/user/__init__.py b/tests/urlparser_data/not_found/user/__init__.py index c47f88e..c47f88e 100644 --- a/paste/tests/urlparser_data/not_found/user/__init__.py +++ b/tests/urlparser_data/not_found/user/__init__.py diff --git a/paste/tests/urlparser_data/not_found/user/list.py b/tests/urlparser_data/not_found/user/list.py index f6228f0..f6228f0 100644 --- a/paste/tests/urlparser_data/not_found/user/list.py +++ b/tests/urlparser_data/not_found/user/list.py diff --git a/paste/tests/urlparser_data/python/__init__.py b/tests/urlparser_data/python/__init__.py index 792d600..792d600 100644 --- a/paste/tests/urlparser_data/python/__init__.py +++ b/tests/urlparser_data/python/__init__.py diff --git a/paste/tests/urlparser_data/python/simpleapp.py b/tests/urlparser_data/python/simpleapp.py index cbef9f1..cbef9f1 100644 --- a/paste/tests/urlparser_data/python/simpleapp.py +++ b/tests/urlparser_data/python/simpleapp.py diff --git a/paste/tests/urlparser_data/python/stream.py b/tests/urlparser_data/python/stream.py index 121b4d1..121b4d1 100644 --- a/paste/tests/urlparser_data/python/stream.py +++ b/tests/urlparser_data/python/stream.py diff --git a/paste/tests/urlparser_data/python/sub/__init__.py b/tests/urlparser_data/python/sub/__init__.py index 792d600..792d600 100644 --- a/paste/tests/urlparser_data/python/sub/__init__.py +++ b/tests/urlparser_data/python/sub/__init__.py diff --git a/paste/tests/urlparser_data/python/sub/simpleapp.py b/tests/urlparser_data/python/sub/simpleapp.py index fd90966..fd90966 100644 --- a/paste/tests/urlparser_data/python/sub/simpleapp.py +++ b/tests/urlparser_data/python/sub/simpleapp.py |