(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func 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 | |
| 338 | func TestCreateCodespaces_displayName(t *testing.T) { |
| 339 | svr := createFakeCreateEndpointServer(t, http.StatusCreated) |
nothing calls this directly
no test coverage detected