MCPcopy Create free account
hub / github.com/cli/cli / mockRetrieveProjects

Function mockRetrieveProjects

pkg/cmd/pr/create/create_test.go:3020–3073  ·  view source on GitHub ↗
(_ *testing.T, reg *httpmock.Registry)

Source from the content-addressed store, hash-verified

3018}
3019
3020func mockRetrieveProjects(_ *testing.T, reg *httpmock.Registry) {
3021 reg.Register(
3022 httpmock.GraphQL(`query RepositoryProjectList\b`),
3023 httpmock.StringResponse(`
3024 { "data": { "repository": { "projects": {
3025 "nodes": [
3026 { "name": "Cleanup", "id": "CLEANUPID", "resourcePath": "/OWNER/REPO/projects/1" },
3027 { "name": "Roadmap", "id": "ROADMAPID", "resourcePath": "/OWNER/REPO/projects/2" }
3028 ],
3029 "pageInfo": { "hasNextPage": false }
3030 } } } }
3031 `))
3032 reg.Register(
3033 httpmock.GraphQL(`query RepositoryProjectV2List\b`),
3034 httpmock.StringResponse(`
3035 { "data": { "repository": { "projectsV2": {
3036 "nodes": [
3037 { "title": "CleanupV2", "id": "CLEANUPV2ID", "resourcePath": "/OWNER/REPO/projects/3" },
3038 { "title": "RoadmapV2", "id": "ROADMAPV2ID", "resourcePath": "/OWNER/REPO/projects/4" }
3039 ],
3040 "pageInfo": { "hasNextPage": false }
3041 } } } }
3042 `))
3043 reg.Register(
3044 httpmock.GraphQL(`query OrganizationProjectList\b`),
3045 httpmock.StringResponse(`
3046 { "data": { "organization": { "projects": {
3047 "nodes": [
3048 { "name": "Triage", "id": "TRIAGEID", "resourcePath": "/orgs/ORG/projects/1" }
3049 ],
3050 "pageInfo": { "hasNextPage": false }
3051 } } } }
3052 `))
3053 reg.Register(
3054 httpmock.GraphQL(`query OrganizationProjectV2List\b`),
3055 httpmock.StringResponse(`
3056 { "data": { "organization": { "projectsV2": {
3057 "nodes": [
3058 { "title": "TriageV2", "id": "TRIAGEV2ID", "resourcePath": "/orgs/ORG/projects/2" }
3059 ],
3060 "pageInfo": { "hasNextPage": false }
3061 } } } }
3062 `))
3063 reg.Register(
3064 httpmock.GraphQL(`query UserProjectV2List\b`),
3065 httpmock.StringResponse(`
3066 { "data": { "viewer": { "projectsV2": {
3067 "nodes": [
3068 { "title": "MonalisaV2", "id": "MONALISAV2ID", "resourcePath": "/user/MONALISA/projects/2" }
3069 ],
3070 "pageInfo": { "hasNextPage": false }
3071 } } } }
3072 `))
3073}
3074
3075// TODO projectsV1Deprecation
3076// Remove this test.

Callers 1

Test_createRunFunction · 0.85

Calls 3

GraphQLFunction · 0.92
StringResponseFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected