Commit 6d2ab21f authored by Martijn Pieters's avatar Martijn Pieters

Simplify tests by moving 'not in req.other' test up to _processInputs.

parent d3305d1e
...@@ -34,6 +34,7 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -34,6 +34,7 @@ class ProcessInputsTests(unittest.TestCase):
env['QUERY_STRING'] = query_string env['QUERY_STRING'] = query_string
req = self._getHTTPRequest(env) req = self._getHTTPRequest(env)
req.processInputs() req.processInputs()
self._noFormValuesInOther(req)
return req return req
def _noTaintedValues(self, req): def _noTaintedValues(self, req):
...@@ -110,7 +111,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -110,7 +111,6 @@ class ProcessInputsTests(unittest.TestCase):
('spacey key', 'val'), ('key', 'spacey val'), ('spacey key', 'val'), ('key', 'spacey val'),
('multi', '1'), ('multi', '2')) ('multi', '1'), ('multi', '2'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -135,7 +135,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -135,7 +135,6 @@ class ProcessInputsTests(unittest.TestCase):
('multiline:lines', 'one\ntwo'), ('multiline:lines', 'one\ntwo'),
('morewords:text', 'one\ntwo\n')) ('morewords:text', 'one\ntwo\n'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -163,7 +162,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -163,7 +162,6 @@ class ProcessInputsTests(unittest.TestCase):
('nouconverter:string:utf8', 'test\xc2\xae')) ('nouconverter:string:utf8', 'test\xc2\xae'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -191,7 +189,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -191,7 +189,6 @@ class ProcessInputsTests(unittest.TestCase):
('setrec.foo:records', 'foo'), ('setrec.bar:records', 'bar'), ('setrec.foo:records', 'foo'), ('setrec.bar:records', 'bar'),
('setrec.foo:records', 'spam'), ('setrec.bar:records', 'eggs')) ('setrec.foo:records', 'spam'), ('setrec.bar:records', 'eggs'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -221,7 +218,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -221,7 +218,6 @@ class ProcessInputsTests(unittest.TestCase):
('ftuple:tuple:float', '1.2'), ('ftuple:tuple:float', '1.2'),
('tlist:tokens:list', 'one two'), ('tlist:list:tokens', '3 4')) ('tlist:tokens:list', 'one two'), ('tlist:list:tokens', '3 4'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -252,7 +248,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -252,7 +248,6 @@ class ProcessInputsTests(unittest.TestCase):
('setrec.ituple:tuple:int:records', '1'), ('setrec.ituple:tuple:int:records', '1'),
('setrec.ituple:tuple:int:records', '2')) ('setrec.ituple:tuple:int:records', '2'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -300,7 +295,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -300,7 +295,6 @@ class ProcessInputsTests(unittest.TestCase):
('setrec.foo:records', 'ham'), ('setrec.foo:records', 'ham'),
) )
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
...@@ -332,7 +326,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -332,7 +326,6 @@ class ProcessInputsTests(unittest.TestCase):
('spacey key', 'val'), ('key', 'spacey val'), ('spacey key', 'val'), ('key', 'spacey val'),
('multi', '1'), ('multi', '2')) ('multi', '1'), ('multi', '2'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -349,7 +342,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -349,7 +342,6 @@ class ProcessInputsTests(unittest.TestCase):
('spacey key', 'val'), ('key', 'spacey val'), ('spacey key', 'val'), ('key', 'spacey val'),
('multi', '1'), ('multi', '2')) ('multi', '1'), ('multi', '2'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -370,7 +362,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -370,7 +362,6 @@ class ProcessInputsTests(unittest.TestCase):
('tnouconverter:string:utf8', '<test\xc2\xae>')) ('tnouconverter:string:utf8', '<test\xc2\xae>'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -420,7 +411,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -420,7 +411,6 @@ class ProcessInputsTests(unittest.TestCase):
('tdeferdefersetrec.foo:records', 'spam'), ('tdeferdefersetrec.foo:records', 'spam'),
('tdeferdefersetrec.bar:records', '<eggs>')) ('tdeferdefersetrec.bar:records', '<eggs>'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -471,7 +461,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -471,7 +461,6 @@ class ProcessInputsTests(unittest.TestCase):
('tdefersecondsetrec.ituple:tuple:int:records', '2'), ('tdefersecondsetrec.ituple:tuple:int:records', '2'),
) )
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -524,7 +513,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -524,7 +513,6 @@ class ProcessInputsTests(unittest.TestCase):
('srdoesnotapply.foo:records', 'baz'), ('srdoesnotapply.foo:records', 'baz'),
('srdoesnotapply.foo:records', 'ham')) ('srdoesnotapply.foo:records', 'ham'))
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
taintedformkeys = list(req.taintedform.keys()) taintedformkeys = list(req.taintedform.keys())
taintedformkeys.sort() taintedformkeys.sort()
...@@ -559,7 +547,6 @@ class ProcessInputsTests(unittest.TestCase): ...@@ -559,7 +547,6 @@ class ProcessInputsTests(unittest.TestCase):
inputs = ( inputs = (
('name.:tuple', 'name with dot as tuple'),) ('name.:tuple', 'name with dot as tuple'),)
req = self._processInputs(inputs) req = self._processInputs(inputs)
self._noFormValuesInOther(req)
formkeys = list(req.form.keys()) formkeys = list(req.form.keys())
formkeys.sort() formkeys.sort()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment