Skip to content

Remove database access from coderd_test #2584

Closed
@kylecarbs

Description

@kylecarbs

This allows us to circumvent creating APIs for users to extract data to ensure our API is functional.

coder/coderd/users_test.go

Lines 149 to 154 in 437066c

// Generated tokens have a longer life
token, err := client.CreateAPIKey(ctx, admin.UserID.String())
require.NoError(t, err, "make new api key")
split = strings.Split(token.Key, "-")
apiKey, err := api.Database.GetAPIKeyByID(ctx, split[0])
require.NoError(t, err, "fetch api key")

We should add an API to fetch information about an API key, not test the value in the database. In v1 this led to an inconsistent API pattern, and we'll approach it similarly in v2 if we don't fix it early.

Metadata

Metadata

Assignees

Labels

apiArea: HTTP API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions