(t *testing.T)
| 1221 | } |
| 1222 | |
| 1223 | func Test_apiRun_paginated_template(t *testing.T) { |
| 1224 | ios, _, stdout, stderr := iostreams.Test() |
| 1225 | ios.SetStdoutTTY(true) |
| 1226 | |
| 1227 | requestCount := 0 |
| 1228 | responses := []*http.Response{ |
| 1229 | { |
| 1230 | StatusCode: 200, |
| 1231 | Header: http.Header{"Content-Type": []string{`application/json`}}, |
| 1232 | Body: io.NopCloser(bytes.NewBufferString(`{ |
| 1233 | "data": { |
| 1234 | "nodes": [ |
| 1235 | { |
| 1236 | "page": 1, |
| 1237 | "caption": "page one" |
| 1238 | } |
| 1239 | ], |
| 1240 | "pageInfo": { |
| 1241 | "endCursor": "PAGE1_END", |
| 1242 | "hasNextPage": true |
| 1243 | } |
| 1244 | } |
| 1245 | }`)), |
| 1246 | }, |
| 1247 | { |
| 1248 | StatusCode: 200, |
| 1249 | Header: http.Header{"Content-Type": []string{`application/json`}}, |
| 1250 | Body: io.NopCloser(bytes.NewBufferString(`{ |
| 1251 | "data": { |
| 1252 | "nodes": [ |
| 1253 | { |
| 1254 | "page": 20, |
| 1255 | "caption": "page twenty" |
| 1256 | } |
| 1257 | ], |
| 1258 | "pageInfo": { |
| 1259 | "endCursor": "PAGE20_END", |
| 1260 | "hasNextPage": false |
| 1261 | } |
| 1262 | } |
| 1263 | }`)), |
| 1264 | }, |
| 1265 | } |
| 1266 | |
| 1267 | options := ApiOptions{ |
| 1268 | IO: ios, |
| 1269 | HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) { |
| 1270 | var tr roundTripper = func(req *http.Request) (*http.Response, error) { |
| 1271 | resp := responses[requestCount] |
| 1272 | resp.Request = req |
| 1273 | requestCount++ |
| 1274 | return resp, nil |
| 1275 | } |
| 1276 | return &http.Client{Transport: tr}, nil |
| 1277 | }, |
| 1278 | Config: func() (gh.Config, error) { |
| 1279 | return config.NewMockConfig(), nil |
| 1280 | }, |
nothing calls this directly
no test coverage detected