From: Lucas Di Pentima Date: Wed, 24 Nov 2021 19:53:02 +0000 (-0300) Subject: 17785: Fixes ACA type so that it doesn't have pointers to string fields. X-Git-Tag: 2.4.0~151^2~1 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/d9c9f862f9bec00285d39dd64d2b677af9aabe92 17785: Fixes ACA type so that it doesn't have pointers to string fields. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go index a456627c0d..723e1011f9 100644 --- a/lib/controller/handler_test.go +++ b/lib/controller/handler_test.go @@ -392,10 +392,30 @@ func (s *HandlerSuite) TestGetObjects(c *check.C) { json.Unmarshal(resp.Body.Bytes(), &ksList) c.Assert(len(ksList.Items), check.Not(check.Equals), 0) ksUUID := ksList.Items[0].UUID + // Create a new token for the test user so that we're not comparing + // the ones from the fixtures. + req = httptest.NewRequest("POST", "/arvados/v1/api_client_authorizations", + strings.NewReader(`{ + "api_client_authorization": { + "owner_uuid": "`+arvadostest.AdminUserUUID+`", + "created_by_ip_address": "::1", + "last_used_by_ip_address": "::1", + "default_owner_uuid": "`+arvadostest.AdminUserUUID+`" + } + }`)) + req.Header.Set("Authorization", "Bearer "+arvadostest.SystemRootToken) + req.Header.Set("Content-type", "application/json") + resp = httptest.NewRecorder() + s.handler.ServeHTTP(resp, req) + c.Assert(resp.Code, check.Equals, http.StatusOK, + check.Commentf("%s", resp.Body.String())) + var auth arvados.APIClientAuthorization + json.Unmarshal(resp.Body.Bytes(), &auth) + c.Assert(auth.UUID, check.Not(check.Equals), "") testCases := map[string]map[string]bool{ "api_clients/" + arvadostest.TrustedWorkbenchAPIClientUUID: nil, - "api_client_authorizations/" + arvadostest.AdminTokenUUID: nil, + "api_client_authorizations/" + auth.UUID: {"href": true, "modified_by_client_uuid": true, "modified_by_user_uuid": true}, "authorized_keys/" + arvadostest.AdminAuthorizedKeysUUID: nil, "collections/" + arvadostest.CollectionWithUniqueWordsUUID: {"href": true}, "containers/" + arvadostest.RunningContainerUUID: nil, @@ -411,7 +431,8 @@ func (s *HandlerSuite) TestGetObjects(c *check.C) { "workflows/" + arvadostest.WorkflowWithDefinitionYAMLUUID: nil, } for url, skippedFields := range testCases { - s.CheckObjectType(c, "/arvados/v1/"+url, arvadostest.AdminToken, skippedFields) + c.Logf("Testing %q", url) + s.CheckObjectType(c, "/arvados/v1/"+url, auth.TokenV2(), skippedFields) } } diff --git a/sdk/go/arvados/api_client_authorization.go b/sdk/go/arvados/api_client_authorization.go index 0fb1dd8940..686caf49d5 100644 --- a/sdk/go/arvados/api_client_authorization.go +++ b/sdk/go/arvados/api_client_authorization.go @@ -12,16 +12,15 @@ type APIClientAuthorization struct { APIClientID int `json:"api_client_id"` APIToken string `json:"api_token"` CreatedAt time.Time `json:"created_at"` - CreatedByIPAddress *string `json:"created_by_ip_address"` - DefaultOwnerUUID *string `json:"default_owner_uuid"` + CreatedByIPAddress string `json:"created_by_ip_address"` + DefaultOwnerUUID string `json:"default_owner_uuid"` Etag string `json:"etag"` ExpiresAt string `json:"expires_at"` - Href string `json:"href"` LastUsedAt time.Time `json:"last_used_at"` - LastUsedByIPAddress *string `json:"last_used_by_ip_address"` + LastUsedByIPAddress string `json:"last_used_by_ip_address"` ModifiedAt time.Time `json:"modified_at"` - ModifiedByClientUUID *string `json:"modified_by_client_uuid"` - ModifiedByUserUUID *string `json:"modified_by_user_uuid"` + ModifiedByClientUUID string `json:"modified_by_client_uuid"` + ModifiedByUserUUID string `json:"modified_by_user_uuid"` OwnerUUID string `json:"owner_uuid"` Scopes []string `json:"scopes"` UserID int `json:"user_id"`