Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite48a44f

Browse files
committed
no panic
1 parent1ea0af3 commite48a44f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎coderd/promoauth/oauth2_test.go‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package promoauth_test
22

33
import (
44
"net/http"
5+
"net/url"
56
"testing"
67
"time"
78

@@ -30,7 +31,7 @@ func TestInstrument(t *testing.T) {
3031
cfg:= externalauth.Config{
3132
InstrumentedOAuth2Config:factory.New(id,idp.OIDCConfig(t, []string{})),
3233
ID:"test",
33-
ValidateURL:must(idp.IssuerURL().Parse("/oauth2/userinfo")).String(),
34+
ValidateURL:must[*url.URL](t)(idp.IssuerURL().Parse("/oauth2/userinfo")).String(),
3435
}
3536

3637
// 0 Requests before we start
@@ -60,7 +61,7 @@ func TestInstrument(t *testing.T) {
6061
// extend the http.DefaultTransport. If a `.Clone()` is not done, this can be
6162
// mis-used. It is cheap to run this quick check.
6263
req,err:=http.NewRequestWithContext(ctx,http.MethodGet,
63-
must(idp.IssuerURL().Parse("/.well-known/openid-configuration")).String(),nil)
64+
must[*url.URL](t)(idp.IssuerURL().Parse("/.well-known/openid-configuration")).String(),nil)
6465
require.NoError(t,err)
6566

6667
resp,err:=http.DefaultClient.Do(req)
@@ -70,9 +71,10 @@ func TestInstrument(t *testing.T) {
7071
require.Equal(t,count(),3)
7172
}
7273

73-
funcmust[Vany](vV,errerror)V {
74-
iferr!=nil {
75-
panic(err)
74+
funcmust[Vany](t*testing.T)func(vV,errerror)V {
75+
returnfunc(vV,errerror)V {
76+
t.Helper()
77+
require.NoError(t,err)
78+
returnv
7679
}
77-
returnv
7880
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp