TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 2074 | // TODO projectsV1Deprecation |
| 2075 | // Remove this test. |
| 2076 | func TestProjectsV1Deprecation(t *testing.T) { |
| 2077 | |
| 2078 | t.Run("non-interactive submission", func(t *testing.T) { |
| 2079 | t.Run("when projects v1 is supported, queries for it", func(t *testing.T) { |
| 2080 | ios, _, _, _ := iostreams.Test() |
| 2081 | |
| 2082 | reg := &httpmock.Registry{} |
| 2083 | reg.StubIssueRepoInfoResponse("OWNER", "REPO") |
| 2084 | reg.Register( |
| 2085 | // ( is required to avoid matching projectsV2 |
| 2086 | httpmock.GraphQL(`projects\(`), |
| 2087 | // Simulate a GraphQL error to early exit the test. |
| 2088 | httpmock.StatusStringResponse(500, ""), |
| 2089 | ) |
| 2090 | |
| 2091 | _, cmdTeardown := run.Stub() |
| 2092 | defer cmdTeardown(t) |
| 2093 | |
| 2094 | // Ignore the error because we have no way to really stub it without |
| 2095 | // fully stubbing a GQL error structure in the request body. |
| 2096 | _ = createRun(&CreateOptions{ |
| 2097 | IO: ios, |
| 2098 | HttpClient: func() (*http.Client, error) { |
| 2099 | return &http.Client{Transport: reg}, nil |
| 2100 | }, |
| 2101 | BaseRepo: func() (ghrepo.Interface, error) { |
| 2102 | return ghrepo.New("OWNER", "REPO"), nil |
| 2103 | }, |
| 2104 | |
| 2105 | Detector: &fd.EnabledDetectorMock{}, |
| 2106 | Title: "Test Title", |
| 2107 | Body: "Test Body", |
| 2108 | // Required to force a lookup of projects |
| 2109 | Projects: []string{"Project"}, |
| 2110 | }) |
| 2111 | |
| 2112 | // Verify that our request contained projects |
| 2113 | reg.Verify(t) |
| 2114 | }) |
| 2115 | |
| 2116 | t.Run("when projects v1 is not supported, does not query for it", func(t *testing.T) { |
| 2117 | ios, _, _, _ := iostreams.Test() |
| 2118 | |
| 2119 | reg := &httpmock.Registry{} |
| 2120 | reg.StubIssueRepoInfoResponse("OWNER", "REPO") |
| 2121 | // ( is required to avoid matching projectsV2 |
| 2122 | reg.Exclude(t, httpmock.GraphQL(`projects\(`)) |
| 2123 | |
| 2124 | _, cmdTeardown := run.Stub() |
| 2125 | defer cmdTeardown(t) |
| 2126 | |
| 2127 | // Ignore the error because we're not really interested in it. |
| 2128 | _ = createRun(&CreateOptions{ |
| 2129 | IO: ios, |
| 2130 | HttpClient: func() (*http.Client, error) { |
| 2131 | return &http.Client{Transport: reg}, nil |
| 2132 | }, |
| 2133 | BaseRepo: func() (ghrepo.Interface, error) { |
nothing calls this directly
no test coverage detected