diff options
author | ianb <devnull@localhost> | 2005-08-22 19:48:45 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-08-22 19:48:45 +0000 |
commit | 9ed8f79838ba500832944614ed6978a0770dcd11 (patch) | |
tree | deba65912a9d14a83d84dd8432bc7a2d3d053247 /tests/test_cgiapp.py | |
parent | 9f508f5baf5adb501affbd02b9109f52993bbf05 (diff) | |
download | paste-9ed8f79838ba500832944614ed6978a0770dcd11.tar.gz |
Moved cgiapp tests
Diffstat (limited to 'tests/test_cgiapp.py')
-rw-r--r-- | tests/test_cgiapp.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_cgiapp.py b/tests/test_cgiapp.py new file mode 100644 index 0000000..f7c5dab --- /dev/null +++ b/tests/test_cgiapp.py @@ -0,0 +1,34 @@ +import os +import py.test +from paste.cgiapp import CGIApplication, CGIError +from paste.fixture import * + +data_dir = os.path.join(os.path.dirname(__file__), 'cgiapp_data') + + +def test_ok(): + app = TestApp(CGIApplication('ok.cgi', [data_dir])) + res = app.get('') + assert res.header('content-type') == 'text/html; charset=UTF-8' + assert res.full_status == '200 Okay' + assert 'This is the body' in res + +def test_form(): + app = TestApp(CGIApplication('form.cgi', [data_dir])) + res = app.post('', params={'name': 'joe'}, + upload_files=[('up', 'file.txt', 'x'*10000)]) + assert 'file.txt' in res + assert 'joe' in res + assert 'x'*10000 in res + +def test_error(): + app = TestApp(CGIApplication('error.cgi', [data_dir])) + py.test.raises(CGIError, "app.get('', status=500)") + +def test_stderr(): + app = TestApp(CGIApplication('stderr.cgi', [data_dir])) + res = app.get('', expect_errors=True) + assert res.status == 500 + assert 'error' in res + assert 'some data' in res.errors + |