Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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
Esempio n. 4
0
 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)
Esempio n. 5
0
    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
Esempio n. 6
0
 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)
Esempio n. 7
0
    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
Esempio n. 8
0
 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)