(t *testing.T)
| 474 | } |
| 475 | |
| 476 | func TestAPIKey_Deleted(t *testing.T) { |
| 477 | t.Parallel() |
| 478 | ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) |
| 479 | defer cancel() |
| 480 | client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) |
| 481 | user := coderdtest.CreateFirstUser(t, client) |
| 482 | _, anotherUser := coderdtest.CreateAnotherUser(t, client, user.OrganizationID) |
| 483 | require.NoError(t, client.DeleteUser(context.Background(), anotherUser.ID)) |
| 484 | |
| 485 | // Attempt to create an API key for the deleted user. This should fail. |
| 486 | _, err := client.CreateAPIKey(ctx, anotherUser.Username) |
| 487 | require.Error(t, err) |
| 488 | var apiErr *codersdk.Error |
| 489 | require.ErrorAs(t, err, &apiErr) |
| 490 | require.Equal(t, http.StatusNotFound, apiErr.StatusCode()) |
| 491 | } |
| 492 | |
| 493 | func TestAPIKey_SetDefault(t *testing.T) { |
| 494 | t.Parallel() |
nothing calls this directly
no test coverage detected