MCPcopy
hub / github.com/cli/cli / Test_runLock

Function Test_runLock

pkg/cmd/issue/lock/lock_test.go:220–732  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func Test_runLock(t *testing.T) {
221 cases := []struct {
222 name string
223 opts LockOptions
224 promptStubs func(*testing.T, *prompter.PrompterMock)
225 httpStubs func(*testing.T, *httpmock.Registry)
226 wantOut string
227 wantErrOut string
228 wantErr string
229 tty bool
230 state string
231 }{
232 {
233 name: "lock issue nontty",
234 state: Lock,
235 opts: LockOptions{
236 IssueNumber: 451,
237 ParentCmd: "issue",
238 },
239 httpStubs: func(t *testing.T, reg *httpmock.Registry) {
240 reg.Register(
241 httpmock.GraphQL(`query IssueByNumber\b`),
242 httpmock.StringResponse(`
243 { "data": { "repository": { "hasIssuesEnabled": true, "issue": {
244 "number": 451,
245 "__typename": "Issue" }}}}`))
246 reg.Register(
247 httpmock.GraphQL(`mutation LockLockable\b`),
248 httpmock.StringResponse(`
249 { "data": {
250 "lockLockable": {
251 "lockedRecord": {
252 "locked": true }}}}`))
253 },
254 },
255 {
256 name: "lock issue tty",
257 tty: true,
258 opts: LockOptions{
259 Interactive: true,
260 IssueNumber: 451,
261 ParentCmd: "issue",
262 },
263 state: Lock,
264 httpStubs: func(t *testing.T, reg *httpmock.Registry) {
265 reg.Register(
266 httpmock.GraphQL(`query IssueByNumber\b`),
267 httpmock.StringResponse(`
268 { "data": { "repository": { "hasIssuesEnabled": true, "issue": {
269 "number": 451,
270 "title": "traverse the library",
271 "__typename": "Issue" }}}}`))
272 reg.Register(
273 httpmock.GraphQL(`mutation LockLockable\b`),
274 httpmock.StringResponse(`
275 { "data": {
276 "lockLockable": {
277 "lockedRecord": {

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
VerifyMethod · 0.95
StringMethod · 0.95
StderrMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
IndexForFunction · 0.92
NoSuchPromptErrFunction · 0.92
TestFunction · 0.92
FromFullNameFunction · 0.92
lockRunFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected