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))
def test_call_with_method_kwargs(self): obj = self.build( declarations.PostGenerationMethodCall('method', data='data'), ) obj.method.assert_called_once_with(data='data')
def test_call_with_passed_extracted_string(self): obj = self.build( declarations.PostGenerationMethodCall('method'), post='data', ) obj.method.assert_called_once_with('data')
def test_call_with_passed_extracted_int(self): obj = self.build( declarations.PostGenerationMethodCall('method'), post=1, ) obj.method.assert_called_once_with(1)
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)
def test_simplest_setup_and_call(self): obj = self.build(declarations.PostGenerationMethodCall('method'), ) obj.method.assert_called_once_with()
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')
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))
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')
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')
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()
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')
def test_call_with_passed_kwargs(self): obj = self.build( declarations.PostGenerationMethodCall('method'), post__data='other', ) obj.method.assert_called_once_with(data='other')
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'))
def test_multi_call_with_multi_method_args(self): with self.assertRaises(errors.InvalidDeclarationError): self.build( declarations.PostGenerationMethodCall('method', 'arg1', 'arg2'), )
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)