Ejemplo n.º 1
0
    def test_multiple_non_list(self):
        model_field = MultipleModelField(FooModel)
        obj = FooModel(one='a')
        obj.pk = 1

        with self.assertRaisesRegexp(ValidationError, "[Ii]terable"):
            cleaned_data = model_field.clean(obj)
Ejemplo n.º 2
0
    def test_model_valid_type(self):
        model_field = ModelField(FooModel)
        model = FooModel(one='Z')
        model.pk = 1

        cleaned_data = model_field.clean(model)

        self.assertTrue(model, cleaned_data)