ocket8888 commented on a change in pull request #4196: TP: Provides the ability 
to view all users for a given role
URL: https://github.com/apache/trafficcontrol/pull/4196#discussion_r375544441
 
 

 ##########
 File path: traffic_ops/testing/api/v1/user_test.go
 ##########
 @@ -292,6 +294,26 @@ func GetTestUsers(t *testing.T) {
        }
 }
 
+func GetTestAdminUsers(t *testing.T) {
+       adminUsers, _, err := TOSession.GetUsersByRole("admin")
+       if err != nil {
+               t.Errorf("cannot GET users by role: %v", err)
+       }
+       if *adminUsers[0].RoleName != "admin" {
 
 Review comment:
   This can cause a segfault, need to check if the length of the returned slice 
is > 0 to ensure safe indexing, then need to make sure that the 0th item's 
`RoleName` property isn't `nil` to ensure safe dereferencing.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to