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

Function TestOAuth2ProviderApps

coderd/oauth2_test.go:36–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34)
35
36func TestOAuth2ProviderApps(t *testing.T) {
37 t.Parallel()
38
39 // NOTE: Unit tests for OAuth2 provider app validation have been migrated to
40 // oauth2provider/provider_test.go for better separation of concerns.
41 // This test function now focuses on integration testing with the full server stack.
42
43 t.Run("IntegrationFlow", func(t *testing.T) {
44 t.Parallel()
45
46 client := coderdtest.New(t, nil)
47 _ = coderdtest.CreateFirstUser(t, client)
48 ctx := testutil.Context(t, testutil.WaitLong)
49
50 // Test basic app creation and management in integration context
51 //nolint:gocritic // OAuth2 app management requires owner permission.
52 app, err := client.PostOAuth2ProviderApp(ctx, codersdk.PostOAuth2ProviderAppRequest{
53 Name: fmt.Sprintf("integration-test-%d", time.Now().UnixNano()%1000000),
54 CallbackURL: "http://localhost:3000",
55 })
56 require.NoError(t, err)
57 require.NotEmpty(t, app.ID)
58 require.NotEmpty(t, app.Name)
59 require.Equal(t, "http://localhost:3000", app.CallbackURL)
60 })
61}
62
63func TestOAuth2ProviderAppSecrets(t *testing.T) {
64 t.Parallel()

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
CreateFirstUserFunction · 0.92
ContextFunction · 0.92
PostOAuth2ProviderAppMethod · 0.80
NotEmptyMethod · 0.80
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected