def test_validate_args_any(self): sig = 'jsonrpc(s1=Any, s2=Any)' default_site.register(sig, public=True)(lambda r, s1, s2: s1 + s2) M = default_site._urls["jsonrpc"] self.assert_(validate_params(M, *['omg', 'wtf']) is None) self.assert_(validate_params(M, *[['omg'], ['wtf']]) is None) self.assert_(validate_params(M, **{'s1': 'omg', 's2': 'wtf'}) is None)
def test_validate_args_any(self): sig = 'jsonrpc(s1=Any, s2=Any)' default_site.register(sig, public=True)(lambda r, s1, s2: s1+s2) M = default_site._urls["jsonrpc"] self.assert_(validate_params(M, *['omg', 'wtf']) is None) self.assert_(validate_params(M, *[['omg'], ['wtf']]) is None) self.assert_(validate_params(M, **{'s1': 'omg', 's2': 'wtf'}) is None)
def test_validate_args(self): sig = 'jsonrpc(String, String) -> String' M = jsonrpc_method(sig, validate=True)(lambda r, s1, s2: s1+s2) self.assert_(validate_params(M, {'params': ['omg', u'wtf']}) is None) E = None try: validate_params(M, {'params': [['omg'], ['wtf']]}) except Exception, e: E = e
def test_validate_args_any(self): sig = 'jsonrpc(s1=Any, s2=Any)' M = jsonrpc_method(sig, validate=True)(lambda r, s1, s2: s1 + s2) self.assert_(validate_params(M, {'params': ['omg', 'wtf']}) is None) self.assert_( validate_params(M, {'params': [['omg'], ['wtf']]}) is None) self.assert_( validate_params(M, {'params': { 's1': 'omg', 's2': 'wtf' }}) is None)
def test_validate_args(self): sig = 'jsonrpc(String, String) -> String' default_site.register(sig, public=True)(lambda r, s1, s2: s1 + s2) M = default_site._urls["jsonrpc"] self.assert_(validate_params(M, 'omg', u'wtf') is None) E = None try: validate_params(M, {'params': [['omg'], ['wtf']]}) except Exception, e: E = e
def test_validate_args(self): sig = 'jsonrpc(String, String) -> String' M = jsonrpc_method(sig, validate=True)(lambda r, s1, s2: s1+s2) self.assertTrue(validate_params(M, {'params': ['omg', 'wtf']}) is None) print(M) E = None try: validate_params(M, {'params': [['omg'], ['wtf']]}) except Exception as e: E = e self.assertTrue(type(E) is InvalidParamsError)
def test_validate_args(self): sig = 'jsonrpc(String, String) -> String' default_site.register(sig, public=True)(lambda r, s1, s2: s1+s2) M = default_site._urls["jsonrpc"] self.assert_(validate_params(M, 'omg', u'wtf') is None) E = None try: validate_params(M, {'params': [['omg'], ['wtf']]}) except Exception, e: E = e
def test_validate_args_any(self): sig = 'jsonrpc(s1=Any, s2=Any)' M = jsonrpc_method(sig, validate=True)(lambda r, s1, s2: s1+s2) self.assert_(validate_params(M, {'params': ['omg', 'wtf']}) is None) self.assert_(validate_params(M, {'params': [['omg'], ['wtf']]}) is None) self.assert_(validate_params(M, {'params': {'s1': 'omg', 's2': 'wtf'}}) is None)