Exemple #1
0
 def test_keywords():
     req = Request({
         'jsonrpc': '2.0',
         'method': 'foo',
         'params': {
             'foo': 'bar'
         }
     })
     req._validate_arguments_against_signature(lambda **kwargs: None)
Exemple #2
0
 def test_positionals_not_passed(self):
     req = Request({
         'jsonrpc': '2.0',
         'method': 'foo',
         'params': {
             'foo': 'bar'
         }
     })
     with self.assertRaises(InvalidParams):
         req._validate_arguments_against_signature(lambda x: None)
Exemple #3
0
 def test_positionals():
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': [1]})
     req._validate_arguments_against_signature(lambda x: None)
Exemple #4
0
 def test_no_arguments_too_many_positionals(self):
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': ['foo']})
     with self.assertRaises(InvalidParams):
         req._validate_arguments_against_signature(lambda: None)
Exemple #5
0
 def test_no_arguments():
     req = Request({'jsonrpc': '2.0', 'method': 'foo'})
     req._validate_arguments_against_signature(lambda: None)
Exemple #6
0
 def test_keywords():
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': {'foo': 'bar'}})
     req._validate_arguments_against_signature(lambda **kwargs: None)
Exemple #7
0
 def test_positionals_not_passed(self):
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': {'foo': 'bar'}})
     with self.assertRaises(InvalidParams):
         req._validate_arguments_against_signature(lambda x: None)
Exemple #8
0
 def test_positionals():
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': [1]})
     req._validate_arguments_against_signature(lambda x: None)
Exemple #9
0
 def test_no_arguments_too_many_positionals(self):
     req = Request({'jsonrpc': '2.0', 'method': 'foo', 'params': ['foo']})
     with self.assertRaises(InvalidParams):
         req._validate_arguments_against_signature(lambda: None)
Exemple #10
0
 def test_no_arguments():
     req = Request({'jsonrpc': '2.0', 'method': 'foo'})
     req._validate_arguments_against_signature(lambda: None)