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

Function mockRetrieveProjects

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

Source from the content-addressed store, hash-verified

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