MCPcopy Index your code
hub / github.com/cli/cli / TestCreateCodespaces

Function TestCreateCodespaces

internal/codespaces/api/api_test.go:309–336  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

307}
308
309func TestCreateCodespaces(t *testing.T) {
310 svr := createFakeCreateEndpointServer(t, http.StatusCreated)
311 defer svr.Close()
312
313 api := API{
314 githubAPI: svr.URL,
315 client: createHttpClient,
316 }
317
318 ctx := context.TODO()
319 retentionPeriod := 0
320 params := &CreateCodespaceParams{
321 RepositoryID: 1,
322 IdleTimeoutMinutes: 10,
323 RetentionPeriodMinutes: &retentionPeriod,
324 }
325 codespace, err := api.CreateCodespace(ctx, params)
326 if err != nil {
327 t.Fatal(err)
328 }
329
330 if codespace.Name != "codespace-1" {
331 t.Fatalf("expected codespace-1, got %s", codespace.Name)
332 }
333 if codespace.DisplayName != "" {
334 t.Fatalf("expected display name empty, got %q", codespace.DisplayName)
335 }
336}
337
338func TestCreateCodespaces_displayName(t *testing.T) {
339 svr := createFakeCreateEndpointServer(t, http.StatusCreated)

Callers

nothing calls this directly

Calls 3

CreateCodespaceMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected