MCPcopy Index your code
hub / github.com/belak/gitdir / TestLookupUserFromInvite

Function TestLookupUserFromInvite

user_test.go:120–162  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestLookupUserFromInvite(t *testing.T) {
121 t.Parallel()
122
123 c := newTestConfig()
124
125 var tests = []struct { //nolint:gofumpt
126 Username string
127 Invite string
128 Error error
129 }{
130 {
131 "an-admin",
132 "valid-invite",
133 nil,
134 },
135 {
136 "an-admin",
137 "invalid-invite",
138 ErrUserNotFound,
139 },
140 {
141 "disabled",
142 "user-disabled",
143 ErrUserNotFound,
144 },
145 {
146 "invalid-user",
147 "user-missing",
148 ErrUserNotFound,
149 },
150 }
151
152 for _, test := range tests {
153 user, err := c.LookupUserFromInvite(test.Invite)
154
155 if test.Error != nil {
156 require.Equal(t, test.Error, err)
157 } else {
158 assert.Nil(t, err)
159 assert.Equal(t, test.Username, user.Username)
160 }
161 }
162}

Callers

nothing calls this directly

Calls 2

newTestConfigFunction · 0.85
LookupUserFromInviteMethod · 0.80

Tested by

no test coverage detected