-
Notifications
You must be signed in to change notification settings - Fork 86
Add WorkItemType Field type verification/tests #77
Comments
Hello @aslakknutsen @tsmaeder @kwk |
I think this task is about adding tests, not a validation infrastructure. |
@tsmaeder What I understood from this ticket and hipchat discussion is - there should be a way for checking "Kind" properly. URL pattern, User instance etc etc should be checked before/while creating WI. Currently the method "ConvertToModel" does not validate types. So added validation infra around. We can discuss on how I can extend this ticket to have validation infra, please let me know. |
@pranavgore09 @tsmaeder Sorry, this got a bit messy. The intent of this task is to verify the Convert does what it should. The Convert is basically a simple DataType conversion from Domain to Storage and back. And this is the wrong layer for the Validation that came up. The Validation of Data content etc should be in the non-existing Domain layer(ref #110). So the thoughts/work around the Validation is not lost, it's just not the correct level to have it. So drop expanding on the Validation part for this part, just verify the Conversion. |
thanks @aslakknutsen |
These test cases are testing ConvertToModel function of the Type. Also added fixes in existing ConvertToModel as needed. Few validations are added in Conversion logic. govalidator lib is added for the validations like IsURL. Fixes: fabric8-services#77
Verify that a WorkItem's Fields can be converted/verified to the correct Type as defined in the WorkItemType definition.
Create a set of unit tests that verify the different Field Type|Kinds can be handled. (and fix code if not working as expected ;)
Kinds: https://github.com/almighty/almighty-core/blob/master/models/field_definition.go#L11
Workitem: https://github.com/almighty/almighty-core/blob/master/models/workitem.go
WorkItemType: https://github.com/almighty/almighty-core/blob/master/models/workitemtype.go
This sounds like a good case for a Table test: https://github.com/golang/go/wiki/TableDrivenTests
Table could contain: field type, value, expected result
Then the test loop over the table;
Ref: https://trello.com/c/nqXR6XHS/66-expand-hardcoded-work-item-types
The text was updated successfully, but these errors were encountered: