MCPcopy Index your code
hub / github.com/cli/cli / TestRunDelete_User

Function TestRunDelete_User

pkg/cmd/project/delete/delete_test.go:84–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestRunDelete_User(t *testing.T) {
85 defer gock.Off()
86 gock.Observe(gock.DumpRequest)
87
88 // get user ID
89 gock.New("https://api.github.com").
90 Post("/graphql").
91 MatchType("json").
92 JSON(map[string]interface{}{
93 "query": "query UserOrgOwner.*",
94 "variables": map[string]interface{}{
95 "login": "monalisa",
96 },
97 }).
98 Reply(200).
99 JSON(map[string]interface{}{
100 "data": map[string]interface{}{
101 "user": map[string]interface{}{
102 "id": "an ID",
103 },
104 },
105 "errors": []interface{}{
106 map[string]interface{}{
107 "type": "NOT_FOUND",
108 "path": []string{"organization"},
109 },
110 },
111 })
112
113 // get project ID
114 gock.New("https://api.github.com").
115 Post("/graphql").
116 MatchType("json").
117 JSON(map[string]interface{}{
118 "query": "query UserProject.*",
119 "variables": map[string]interface{}{
120 "login": "monalisa",
121 "number": 1,
122 "firstItems": 0,
123 "afterItems": nil,
124 "firstFields": 0,
125 "afterFields": nil,
126 },
127 }).
128 Reply(200).
129 JSON(map[string]interface{}{
130 "data": map[string]interface{}{
131 "user": map[string]interface{}{
132 "projectV2": map[string]interface{}{
133 "id": "an ID",
134 },
135 },
136 },
137 })
138
139 // delete project
140 gock.New("https://api.github.com").
141 Post("/graphql").

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
runDeleteFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected