def test_good_model(self): schema = to_schema(Conference) schema.deserialize({ 'id': 1, 'name': 'Conf 1', 'description': 'foo', 'is_active': True })
def test_good_model(self): schema = to_schema(Conference) schema.deserialize({ 'id': 1 , 'name': 'Conf 1' , 'description': 'foo' , 'is_active': True })
def test_badg_length(self): schema = to_schema(Conference) had_exception = False try: schema.deserialize({ 'id': 1, 'name': '12345678910111213', 'description': 'foo', 'is_active': True }) except colander.Invalid, e: had_exception = True errors = e.asdict() assert errors['name'] == 'Longer than maximum length 10'
def test_bad_model(self): schema = to_schema(Conference) had_exception = False try: schema.deserialize({}) except colander.Invalid, e: errors = e.asdict() had_exception = True assert errors['id'] == 'Required' assert errors['name'] == 'Required' assert errors['is_active'] == 'Required' assert not 'description' in errors
def test_badg_length(self): schema = to_schema(Conference) had_exception = False try: schema.deserialize({ 'id': 1 , 'name': '12345678910111213' , 'description': 'foo' , 'is_active': True }) except colander.Invalid, e: had_exception = True errors = e.asdict() assert errors['name'] == 'Longer than maximum length 10'
def test_bad_model(self): schema = to_schema(Conference) had_exception = False try: schema.deserialize({}) except colander.Invalid, e: errors = e.asdict() had_exception = True assert errors['id'] == 'Required' assert errors['name'] == 'Required' assert errors['is_active'] == 'Required' assert not 'description' in errors