models: refactor tests into functions
fields: use a descriptor in the model field with extra validation

refs #72