@@ -2,6 +2,7 @@ package promoauth_test
2
2
3
3
import (
4
4
"net/http"
5
+ "net/url"
5
6
"testing"
6
7
"time"
7
8
@@ -30,7 +31,7 @@ func TestInstrument(t *testing.T) {
30
31
cfg := externalauth.Config {
31
32
InstrumentedOAuth2Config :factory .New (id ,idp .OIDCConfig (t , []string {})),
32
33
ID :"test" ,
33
- ValidateURL :must (idp .IssuerURL ().Parse ("/oauth2/userinfo" )).String (),
34
+ ValidateURL :must [ * url. URL ]( t ) (idp .IssuerURL ().Parse ("/oauth2/userinfo" )).String (),
34
35
}
35
36
36
37
// 0 Requests before we start
@@ -60,7 +61,7 @@ func TestInstrument(t *testing.T) {
60
61
// extend the http.DefaultTransport. If a `.Clone()` is not done, this can be
61
62
// mis-used. It is cheap to run this quick check.
62
63
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 )
64
65
require .NoError (t ,err )
65
66
66
67
resp ,err := http .DefaultClient .Do (req )
@@ -70,9 +71,10 @@ func TestInstrument(t *testing.T) {
70
71
require .Equal (t ,count (),3 )
71
72
}
72
73
73
- func must [V any ](v V ,err error )V {
74
- if err != nil {
75
- panic (err )
74
+ func must [V any ](t * testing.T )func (v V ,err error )V {
75
+ return func (v V ,err error )V {
76
+ t .Helper ()
77
+ require .NoError (t ,err )
78
+ return v
76
79
}
77
- return v
78
80
}