def test_initial(self): """ Test :py:meth:`.FormMixin.get_initial`. """ mixin = FormMixin() mixin.initial = {'foo': 'bar'} self.assertEqual({'foo': 'bar'}, mixin.get_initial())
def test_get_form_kwargs(self, request): """ Test :py:meth:`.FormMixin.get_form_kwargs`. """ request.form = {'foo': 'bar'} mixin = FormMixin() mixin.get_initial = Mock(return_value={'name': 'John'}) self.assertEqual({ 'formdata': {'foo': 'bar'}, 'name': 'John', }, mixin.get_form_kwargs()) mixin.get_initial.assert_called_once_with()
def test_get_form_kwargs(self, request): """ Test :py:meth:`.FormMixin.get_form_kwargs`. """ request.form = {'foo': 'bar'} mixin = FormMixin() mixin.get_initial = Mock(return_value={'name': 'John'}) self.assertEqual({ 'formdata': { 'foo': 'bar' }, 'name': 'John', }, mixin.get_form_kwargs()) mixin.get_initial.assert_called_once_with()