ocket8888 commented on a change in pull request #5314:
URL: https://github.com/apache/trafficcontrol/pull/5314#discussion_r529866915
##########
File path: traffic_ops/traffic_ops_golang/region/regions_test.go
##########
@@ -109,3 +108,30 @@ func TestInterfaces(t *testing.T) {
t.Errorf("Region must be Identifier")
}
}
+func TestValidation(t *testing.T) {
+ testRegion := tc.Region{
+ DivisionName: "west",
+ ID: 1,
+ Name: "region1",
+ LastUpdated: tc.TimeNoMod{Time: time.Now()},
+ }
+ testTORegion := TORegion{Region: testRegion}
+ errs := test.SortErrors(test.SplitErrors(testTORegion.Validate()))
+
+ if len(errs) > 0 {
+ t.Errorf(`expected no errors, got %v`, errs)
Review comment:
No, I don't think so. I think only the ID should be required, as the
docs say:
> _"The only “division” key that actually matters in the request body is
`division`; `divisionName` is not validated and has no effect - particularly
not the effect of re-naming the division - beyond changing the name in the API
response to this request. Subsequent requests will reveal the true name of the
division. Note that if `divisionName` is not present in the request body it
will be null in the response, but again further requests will show the true
division name (provided it has been assigned to a division)._"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]