diff options
author | pjenvey <devnull@localhost> | 2007-01-19 06:43:05 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2007-01-19 06:43:05 +0000 |
commit | 0369e8bb38e43986c2b821687317b89f670e62cf (patch) | |
tree | 0de06b3127b3dd5923490b1e048b3a5434d38692 /tests | |
parent | 7491298691ea496b22b085370c215df9465e4b74 (diff) | |
download | paste-0369e8bb38e43986c2b821687317b89f670e62cf.tar.gz |
some test fixes. still not passing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_request_form.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/test_request_form.py b/tests/test_request_form.py index 63a182b..9c43b46 100644 --- a/tests/test_request_form.py +++ b/tests/test_request_form.py @@ -1,29 +1,30 @@ +import cgi from cStringIO import StringIO from paste.request import * -import cgi +from paste.util.multidict import MultiDict -def test_parse_qs(): +def test_parse_querystring(): e = {'QUERY_STRING': 'a=1&b=2&c=3&b=4'} - d = parse_qs(e) + d = parse_querystring(e) assert d == [('a', '1'), ('b', '2'), ('c', '3'), ('b', '4')] - assert e['paste._cached_parse_qs'] == ( - (e['QUERY_STRING'], d)) + assert e['paste.parsed_querystring'] == ( + (d, e['QUERY_STRING'])) e = {'QUERY_STRING': 'a&b&c=&d=1'} - d = parse_qs(e) - assert d == [('a', None), ('b', None), ('c', ''), ('d', '1')] + d = parse_querystring(e) + assert d == [('a', ''), ('b', ''), ('c', ''), ('d', '1')] def make_post(body): e = { - 'CONTENT_TYPE': 'application/x-www-urlencoded', + 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'CONTENT_LENGTH': str(len(body)), 'wsgi.input': StringIO(body), } return e def cmp_post(fs, lst): - if len(lst) != len(fs.list): + if len(lst) != len(fs): print 'Lengths do not match: %r vs expected %r' % ( - len(lst), len(fs.list)) + len(lst), len(fs)) return False for fs_item, (expect_name, expect_value) in zip(fs.list, lst): if fs_item.name != expect_name: @@ -35,15 +36,14 @@ def cmp_post(fs, lst): return False return True -def test_parse_post(): +def test_parsevars(): e = make_post('a=1&b=2&c=3&b=4') cur_input = e['wsgi.input'] - d = parse_post(e) - assert isinstance(d, cgi.FieldStorage) + d = parse_formvars(e) + assert isinstance(d, MultiDict) assert cmp_post(d, [('a', '1'), ('b', '2'), ('c', '3'), ('b', '4')]) - assert e['paste._cached_parse_post'] == ( - (e['wsgi.input'], cur_input, d)) + assert e['paste.parsed_formvars'] == ( + (d, e['wsgi.input'])) assert e['wsgi.input'] is not cur_input cur_input.seek(0) assert e['wsgi.input'].read() == cur_input.read() - |