(t *testing.T)
| 376 | } |
| 377 | |
| 378 | func TestProjectV1Support(t *testing.T) { |
| 379 | tests := []struct { |
| 380 | name string |
| 381 | hostname string |
| 382 | httpStubs func(*httpmock.Registry) |
| 383 | wantFeatures gh.ProjectsV1Support |
| 384 | }{ |
| 385 | { |
| 386 | name: "github.com", |
| 387 | hostname: "github.com", |
| 388 | wantFeatures: gh.ProjectsV1Unsupported, |
| 389 | }, |
| 390 | { |
| 391 | name: "ghec data residency (ghe.com)", |
| 392 | hostname: "stampname.ghe.com", |
| 393 | wantFeatures: gh.ProjectsV1Unsupported, |
| 394 | }, |
| 395 | { |
| 396 | name: "GHE 3.16.0", |
| 397 | hostname: "git.my.org", |
| 398 | httpStubs: func(reg *httpmock.Registry) { |
| 399 | reg.Register( |
| 400 | httpmock.REST("GET", "api/v3/meta"), |
| 401 | httpmock.StringResponse(`{"installed_version":"3.16.0"}`), |
| 402 | ) |
| 403 | }, |
| 404 | wantFeatures: gh.ProjectsV1Supported, |
| 405 | }, |
| 406 | { |
| 407 | name: "GHE 3.16.1", |
| 408 | hostname: "git.my.org", |
| 409 | httpStubs: func(reg *httpmock.Registry) { |
| 410 | reg.Register( |
| 411 | httpmock.REST("GET", "api/v3/meta"), |
| 412 | httpmock.StringResponse(`{"installed_version":"3.16.1"}`), |
| 413 | ) |
| 414 | }, |
| 415 | wantFeatures: gh.ProjectsV1Supported, |
| 416 | }, |
| 417 | { |
| 418 | name: "GHE 3.17", |
| 419 | hostname: "git.my.org", |
| 420 | httpStubs: func(reg *httpmock.Registry) { |
| 421 | reg.Register( |
| 422 | httpmock.REST("GET", "api/v3/meta"), |
| 423 | httpmock.StringResponse(`{"installed_version":"3.17.0"}`), |
| 424 | ) |
| 425 | }, |
| 426 | wantFeatures: gh.ProjectsV1Unsupported, |
| 427 | }, |
| 428 | } |
| 429 | |
| 430 | for _, tt := range tests { |
| 431 | t.Run(tt.name, func(t *testing.T) { |
| 432 | t.Parallel() |
| 433 | reg := &httpmock.Registry{} |
| 434 | if tt.httpStubs != nil { |
| 435 | tt.httpStubs(reg) |
nothing calls this directly
no test coverage detected