MustWorkspace is a convenience method for fetching a workspace that should exist.
(t testing.TB, client *codersdk.Client, workspaceID uuid.UUID)
| 1488 | |
| 1489 | // MustWorkspace is a convenience method for fetching a workspace that should exist. |
| 1490 | func MustWorkspace(t testing.TB, client *codersdk.Client, workspaceID uuid.UUID) codersdk.Workspace { |
| 1491 | t.Helper() |
| 1492 | ctx := context.Background() |
| 1493 | ws, err := client.Workspace(ctx, workspaceID) |
| 1494 | if err != nil && strings.Contains(err.Error(), "status code 410") { |
| 1495 | ws, err = client.DeletedWorkspace(ctx, workspaceID) |
| 1496 | } |
| 1497 | require.NoError(t, err, "no workspace found with id %s", workspaceID) |
| 1498 | return ws |
| 1499 | } |
| 1500 | |
| 1501 | // RequestExternalAuthCallback makes a request with the proper OAuth2 state cookie |
| 1502 | // to the external auth callback endpoint. |