|
a/AlluraTesting/alluratest/validation.py |
|
b/AlluraTesting/alluratest/validation.py |
|
... |
|
... |
16 |
import mock
|
16 |
import mock
|
17 |
import beaker.session
|
17 |
import beaker.session
|
18 |
from paste.deploy import loadapp
|
18 |
from paste.deploy import loadapp
|
19 |
from paste.script.appinstall import SetupCommand
|
19 |
from paste.script.appinstall import SetupCommand
|
20 |
from pylons import c, g, url, request, response, session
|
20 |
from pylons import c, g, url, request, response, session
|
|
|
21 |
import webtest
|
21 |
from webtest import TestApp
|
22 |
from webtest import TestApp
|
22 |
from webob import Request, Response
|
23 |
from webob import Request, Response
|
23 |
from nose.tools import ok_, assert_true, assert_false
|
24 |
from nose.tools import ok_, assert_true, assert_false
|
24 |
from poster.encode import multipart_encode
|
25 |
from poster.encode import multipart_encode
|
25 |
from poster.streaminghttp import register_openers
|
26 |
from poster.streaminghttp import register_openers
|
|
... |
|
... |
233 |
if hasattr(params, 'items'):
|
234 |
if hasattr(params, 'items'):
|
234 |
params = params.items()
|
235 |
params = params.items()
|
235 |
for k, v in params:
|
236 |
for k, v in params:
|
236 |
if not isinstance(k, basestring):
|
237 |
if not isinstance(k, basestring):
|
237 |
raise TypeError('%s key %s is %s, not str' % (method, k, type(k)))
|
238 |
raise TypeError('%s key %s is %s, not str' % (method, k, type(k)))
|
238 |
if not isinstance(v, basestring):
|
239 |
if not isinstance(v, (basestring, webtest.app.File)):
|
239 |
raise TypeError('%s key %s has value %s of type %s, not str. ' % (method, k, v, type(v)))
|
240 |
raise TypeError('%s key %s has value %s of type %s, not str. ' % (method, k, v, type(v)))
|
240 |
|
241 |
|
241 |
def get(self, *args, **kwargs):
|
242 |
def get(self, *args, **kwargs):
|
242 |
self._validate_params(kwargs.get('params'), 'get')
|
243 |
self._validate_params(kwargs.get('params'), 'get')
|
243 |
return super(PostParamCheckingTestApp, self).get(*args, **kwargs)
|
244 |
return super(PostParamCheckingTestApp, self).get(*args, **kwargs)
|