(ctx context.Context, t *testing.T, client *codersdk.Client, suffix string)
| 863 | } |
| 864 | |
| 865 | func generateApps(ctx context.Context, t *testing.T, client *codersdk.Client, suffix string) provisionedApps { |
| 866 | create := func(name, callback string) codersdk.OAuth2ProviderApp { |
| 867 | name = fmt.Sprintf("%s-%s", name, suffix) |
| 868 | //nolint:gocritic // OAauth2 app management requires owner permission. |
| 869 | app, err := client.PostOAuth2ProviderApp(ctx, codersdk.PostOAuth2ProviderAppRequest{ |
| 870 | Name: name, |
| 871 | CallbackURL: callback, |
| 872 | Icon: "", |
| 873 | }) |
| 874 | require.NoError(t, err) |
| 875 | require.Equal(t, name, app.Name) |
| 876 | require.Equal(t, callback, app.CallbackURL) |
| 877 | return app |
| 878 | } |
| 879 | |
| 880 | return provisionedApps{ |
| 881 | Default: create("app-a", "http://localhost1:8080/foo/bar"), |
| 882 | NoPort: create("app-b", "http://localhost2"), |
| 883 | Subdomain: create("app-z", "http://30.localhost:3000"), |
| 884 | Extra: []codersdk.OAuth2ProviderApp{ |
| 885 | create("app-x", "http://20.localhost:3000"), |
| 886 | create("app-y", "http://10.localhost:3000"), |
| 887 | }, |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | // generatePKCE creates a PKCE verifier and S256 challenge for testing. |
| 892 | func generatePKCE() (verifier, challenge string) { |
no test coverage detected