MCPcopy Index your code
hub / github.com/coder/coder / TestUserAuthMethods

Function TestUserAuthMethods

coderd/userauth_test.go:169–197  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestUserAuthMethods(t *testing.T) {
170 t.Parallel()
171 t.Run("Password", func(t *testing.T) {
172 t.Parallel()
173 client := coderdtest.New(t, nil)
174
175 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
176 defer cancel()
177
178 methods, err := client.AuthMethods(ctx)
179 require.NoError(t, err)
180 require.True(t, methods.Password.Enabled)
181 require.False(t, methods.Github.Enabled)
182 })
183 t.Run("Github", func(t *testing.T) {
184 t.Parallel()
185 client := coderdtest.New(t, &coderdtest.Options{
186 GithubOAuth2Config: &coderd.GithubOAuth2Config{},
187 })
188
189 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
190 defer cancel()
191
192 methods, err := client.AuthMethods(ctx)
193 require.NoError(t, err)
194 require.True(t, methods.Password.Enabled)
195 require.True(t, methods.Github.Enabled)
196 })
197}
198
199// nolint:bodyclose
200func TestUserOAuth2Github(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewFunction · 0.92
AuthMethodsMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected