def test_ParameterForm_choice_data(self): """Test ParameterForm with choice parameter.""" form = ParameterForm([self.choice_base]) self.assertTrue( isinstance(form.fields[self.choice_base.name], forms.ChoiceField)) self.assertEquals( form.fields[self.choice_base.name].choices, [(self.choice.id, self.choice.value)], )
def test_ParameterForm_invalid_data(self): """Test ParameterForm with invalid parameter.""" parameter = ParameterMock("invalid_field", 7) form = ParameterForm([parameter]) self.assertFalse(form.is_valid())
def test_ParameterForm_float_data(self): """Test ParameterForm with float parameter.""" form = ParameterForm([self.float_base]) self.assertTrue( isinstance(form.fields[self.float_base.name], forms.FloatField))
def test_ParameterForm_int_data(self): """Test ParameterForm with integer parameter.""" form = ParameterForm([self.int_base]) self.assertTrue( isinstance(form.fields[self.int_base.name], forms.IntegerField))
def test_ParameterForm_text_data(self): """Test ParameterForm with text parameter.""" form = ParameterForm([self.text_base]) self.assertTrue( isinstance(form.fields[self.text_base.name], forms.CharField))
def test_ParameterForm_bool_data(self): """Test ParameterForm with bool parameter.""" form = ParameterForm([self.bool_base]) self.assertTrue( isinstance(form.fields[self.bool_base.name], forms.BooleanField))