MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / TestEditUser

Function TestEditUser

cmd/edit_user_test.go:29–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func TestEditUser(t *testing.T) {
30 tt := []struct {
31 name string
32 flagsMap map[string]string
33 args []string
34 expect testResult
35 }{
36 {
37 name: "edit user using all possible flags",
38 flagsMap: map[string]string{
39 // TODO: create a new user, and use new-username
40 // "username": "matt.hunter",
41 "name": "matt.swagger",
42 "email": "matt.swagger@example.com",
43 "password": "12345678",
44 "external": "false",
45 "admin": "false",
46 "can-create-group": "false",
47 "skip-reconfirmation": "false",
48 "skype": "matt.swagger",
49 "linkedin": "matt.swagger",
50 "twitter": "matt.swagger",
51 "website-url": "matt.swagger.com",
52 "org": "matt.swagger org",
53 "external-uid": "matt.swagger",
54 "provider": "github",
55 "bio": "like a sir",
56 "location": "london",
57 "projects-limit": "5",
58 },
59 args: []string{"matt.hunter"},
60 expect: pass,
61 },
62 {
63 name: "editing a non existent user should fail",
64 flagsMap: map[string]string{
65 "name": "x.swagger",
66 },
67 args: []string{"x.hunter"},
68 expect: fail,
69 },
70 }
71
72 for _, tc := range tt {
73 t.Run(tc.name, func(t *testing.T) {
74 execT := execTestCmdFlags{
75 t: t,
76 cmd: editUserCmd,
77 flagsMap: tc.flagsMap,
78 args: tc.args,
79 }
80
81 stdout, execResult := execT.executeCommand()
82 require.Equal(t, tc.expect, execResult,
83 printFlagsTable(tc.flagsMap, stdout))
84 })
85 }
86

Callers

nothing calls this directly

Calls 2

executeCommandMethod · 0.95
printFlagsTableFunction · 0.85

Tested by

no test coverage detected