MCPcopy
hub / github.com/cli/cli / TestNewCmdSet

Function TestNewCmdSet

pkg/cmd/variable/set/set_test.go:24–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestNewCmdSet(t *testing.T) {
25 tests := []struct {
26 name string
27 cli string
28 wants SetOptions
29 stdinTTY bool
30 wantsErr bool
31 }{
32 {
33 name: "invalid visibility type",
34 cli: "cool_variable --org coolOrg -v'mistyVeil'",
35 wantsErr: true,
36 },
37 {
38 name: "selected visibility with no repos selected",
39 cli: "cool_variable --org coolOrg -v'selected'",
40 wantsErr: true,
41 },
42 {
43 name: "private visibility with repos selected",
44 cli: "cool_variable --org coolOrg -v'private' -rcoolRepo",
45 wantsErr: true,
46 },
47 {
48 name: "no name specified",
49 cli: "",
50 wantsErr: true,
51 },
52 {
53 name: "multiple names specified",
54 cli: "cool_variable good_variable",
55 wantsErr: true,
56 },
57 {
58 name: "visibility without org",
59 cli: "cool_variable -vall",
60 wantsErr: true,
61 },
62 {
63 name: "repos without explicit visibility",
64 cli: "cool_variable -bs --org coolOrg -rcoolRepo",
65 wants: SetOptions{
66 VariableName: "cool_variable",
67 Visibility: shared.Selected,
68 RepositoryNames: []string{"coolRepo"},
69 Body: "s",
70 OrgName: "coolOrg",
71 },
72 },
73 {
74 name: "org with explicit visibility and selected repo",
75 cli: "-ocoolOrg -bs -vselected -rcoolRepo cool_variable",
76 wants: SetOptions{
77 VariableName: "cool_variable",
78 Visibility: shared.Selected,
79 RepositoryNames: []string{"coolRepo"},
80 Body: "s",
81 OrgName: "coolOrg",

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
SetStdinTTYMethod · 0.80
EqualMethod · 0.80
NewCmdSetFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected