示例#1
0
 def test_call_with_passed_extracted_iterable(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post=(1, 2, 3),
     )
     obj.method.assert_called_once_with((1, 2, 3))
示例#2
0
 def test_call_with_method_kwargs(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method', data='data'), )
     obj.method.assert_called_once_with(data='data')
示例#3
0
 def test_call_with_passed_extracted_string(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post='data',
     )
     obj.method.assert_called_once_with('data')
示例#4
0
 def test_call_with_passed_extracted_int(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post=1,
     )
     obj.method.assert_called_once_with(1)
示例#5
0
 def test_multi_call_with_kwargs(self):
     decl = declarations.PostGenerationMethodCall(
             'method', 'arg1', 'arg2')
     decl.call(self.obj, False, self.ctx(extra={'x': 2}))
     self.obj.method.assert_called_once_with('arg1', 'arg2', x=2)
示例#6
0
 def test_simplest_setup_and_call(self):
     obj = self.build(declarations.PostGenerationMethodCall('method'), )
     obj.method.assert_called_once_with()
示例#7
0
 def test_call_with_passed_kwargs(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx(extra={'data': 'other'}))
     self.obj.method.assert_called_once_with(data='other')
 def test_multi_call_with_multi_method_args(self):
     decl = declarations.PostGenerationMethodCall('method', 'arg1', 'arg2')
     decl.call(self.obj, False)
     self.obj.method.assert_called_once_with('arg1', 'arg2')
示例#9
0
 def test_call_with_passed_extracted_iterable(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx((1, 2, 3)))
     self.obj.method.assert_called_once_with((1, 2, 3))
示例#10
0
 def test_call_with_method_kwargs(self):
     decl = declarations.PostGenerationMethodCall(
             'method', data='data')
     decl.call(self.obj, False, self.ctx())
     self.obj.method.assert_called_once_with(data='data')
示例#11
0
 def test_call_with_passed_extracted_string(self):
     decl = declarations.PostGenerationMethodCall(
             'method')
     decl.call(self.obj, False, self.ctx('data'))
     self.obj.method.assert_called_once_with('data')
示例#12
0
 def test_simplest_setup_and_call(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx())
     self.obj.method.assert_called_once_with()
示例#13
0
 def test_multi_call_with_passed_multiple_args(self):
     decl = declarations.PostGenerationMethodCall('method', 'arg1', 'arg2')
     decl.call(self.obj, False, ('param1', 'param2', 'param3'))
     self.obj.method.assert_called_once_with('param1', 'param2', 'param3')
示例#14
0
 def test_call_with_passed_kwargs(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post__data='other',
     )
     obj.method.assert_called_once_with(data='other')
示例#15
0
 def test_multi_call_with_passed_tuple(self):
     decl = declarations.PostGenerationMethodCall(
             'method', 'arg1', 'arg2')
     decl.call(self.obj, False, self.ctx((('param1', 'param2'),)))
     self.obj.method.assert_called_once_with(('param1', 'param2'))
示例#16
0
 def test_multi_call_with_multi_method_args(self):
     with self.assertRaises(errors.InvalidDeclarationError):
         self.build(
             declarations.PostGenerationMethodCall('method', 'arg1',
                                                   'arg2'), )
示例#17
0
 def test_call_with_passed_extracted_int(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, 1)
     self.obj.method.assert_called_once_with(1)