downscope: refactor some code to remove an extraneous function and instead run that code inside of Token()

This commit is contained in:
Patrick Jones
2021-06-22 13:14:47 -07:00
parent 304d28ba9e
commit 1024258a24
2 changed files with 18 additions and 22 deletions

View File

@@ -46,7 +46,9 @@ func Test_DownscopedTokenSource(t *testing.T) {
}
myTok := oauth2.Token{AccessToken: "Mellon"}
tmpSrc := oauth2.StaticTokenSource(&myTok)
_, err := downscopedTokenWithEndpoint(context.Background(), DownscopingConfig{tmpSrc, new}, ts.URL)
dts := downscopingTokenSource{context.Background(), DownscopingConfig{tmpSrc, new}}
identityBindingEndpoint = ts.URL
_, err := dts.Token()
if err != nil {
t.Fatalf("NewDownscopedTokenSource failed with error: %v", err)
}