MCPcopy
hub / github.com/cli/cli / Test_editRun_interactive

Function Test_editRun_interactive

pkg/cmd/repo/edit/edit_test.go:340–844  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

338}
339
340func Test_editRun_interactive(t *testing.T) {
341 editList := []string{
342 "Default Branch Name",
343 "Description",
344 "Home Page URL",
345 "Issues",
346 "Merge Options",
347 "Projects",
348 "Template Repository",
349 "Topics",
350 "Visibility",
351 "Wikis"}
352
353 tests := []struct {
354 name string
355 opts EditOptions
356 promptStubs func(*prompter.MockPrompter)
357 httpStubs func(*testing.T, *httpmock.Registry)
358 wantsStderr string
359 wantsErr string
360 }{
361 {
362 name: "forking of org repo",
363 opts: EditOptions{
364 Repository: ghrepo.NewWithHost("OWNER", "REPO", "github.com"),
365 InteractiveMode: true,
366 },
367 promptStubs: func(pm *prompter.MockPrompter) {
368 el := append(editList, optionAllowForking)
369 pm.RegisterMultiSelect("What do you want to edit?", nil, el,
370 func(_ string, _, opts []string) ([]int, error) {
371 return []int{10}, nil
372 })
373 pm.RegisterConfirm("Allow forking (of an organization repository)?", func(_ string, _ bool) (bool, error) {
374 return true, nil
375 })
376 },
377 httpStubs: func(t *testing.T, reg *httpmock.Registry) {
378 reg.Register(
379 httpmock.GraphQL(`query RepositoryInfo\b`),
380 httpmock.StringResponse(`
381 {
382 "data": {
383 "repository": {
384 "visibility": "public",
385 "description": "description",
386 "homePageUrl": "https://url.com",
387 "defaultBranchRef": {
388 "name": "main"
389 },
390 "isInOrganization": true,
391 "repositoryTopics": {
392 "nodes": [{
393 "topic": {
394 "name": "x"
395 }
396 }]
397 }

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
NewWithHostFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
RESTFunction · 0.92
RESTPayloadFunction · 0.92
IndexForFunction · 0.92
TestFunction · 0.92
NewMockPrompterFunction · 0.92
EqualMethod · 0.80
ExcludeMethod · 0.80
SetStdoutTTYMethod · 0.80

Tested by

no test coverage detected