diff options
| author | ianb <devnull@localhost> | 2005-08-15 16:49:21 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-08-15 16:49:21 +0000 |
| commit | 855296d30ad93e655ef75812d9f1a96bc629d4da (patch) | |
| tree | 46ce6255d1be8678e8aa99c0b187b2a55e62027a /paste/tests/test_cgiapp.py | |
| parent | b146bb5a4942bf2f531975068357de35197d9a17 (diff) | |
| download | paste-855296d30ad93e655ef75812d9f1a96bc629d4da.tar.gz | |
Added CGI proxy application
Diffstat (limited to 'paste/tests/test_cgiapp.py')
| -rw-r--r-- | paste/tests/test_cgiapp.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/paste/tests/test_cgiapp.py b/paste/tests/test_cgiapp.py new file mode 100644 index 0000000..133cd87 --- /dev/null +++ b/paste/tests/test_cgiapp.py @@ -0,0 +1,35 @@ +import os +import py.test +from paste.cgiapp import CGIApplication, CGIError +from fixture import * +del setup_module + +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 + |
