def test_m2m_save_blank(): obj = Student(name='tim') validator = ModelValidator(obj) valid = validator.validate({'courses': [{}, {}]}) assert valid validator.save() assert obj.id
def test_save(): obj = BasicFields(field1='one', field2='124124', field3='1232314') validator = ModelValidator(obj) valid = validator.validate({'field1': 'updated'}) assert valid validator.save() assert obj.id assert obj.field1 == 'updated'
def test_m2m_save(): obj = Student(name='tim') validator = ModelValidator(obj) c1 = Course.create(name='course1') c2 = Course.create(name='course2') valid = validator.validate({'courses': [c1, c2]}) assert valid validator.save() assert obj.id assert c1 in obj.courses assert c2 in obj.courses