forked from remote/oauth2
google/externalaccount: moves externalaccount package out of internal and exports it
go/programmable-auth-design for context. Adds support for user defined supplier methods to return subject tokens and AWS security credentials. Change-Id: I7bc41f8c5202ae933fce516632f5049bbeb3d378 GitHub-Last-Rev: ac519b242f8315df572f1b205b0670f139bfc6c3 GitHub-Pull-Request: golang/oauth2#690 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/550835 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Leo Siracusa <leosiracusa@google.com> Reviewed-by: Chris Smith <chrisdsmith@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cody Oss <codyoss@google.com>
This commit is contained in:
48
google/externalaccount/header_test.go
Normal file
48
google/externalaccount/header_test.go
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package externalaccount
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestGoVersion(t *testing.T) {
|
||||
testVersion := func(v string) func() string {
|
||||
return func() string {
|
||||
return v
|
||||
}
|
||||
}
|
||||
for _, tst := range []struct {
|
||||
v func() string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
testVersion("go1.19"),
|
||||
"1.19.0",
|
||||
},
|
||||
{
|
||||
testVersion("go1.21-20230317-RC01"),
|
||||
"1.21.0-20230317-RC01",
|
||||
},
|
||||
{
|
||||
testVersion("devel +abc1234"),
|
||||
"abc1234",
|
||||
},
|
||||
{
|
||||
testVersion("this should be unknown"),
|
||||
versionUnknown,
|
||||
},
|
||||
} {
|
||||
version = tst.v
|
||||
got := goVersion()
|
||||
if diff := cmp.Diff(got, tst.want); diff != "" {
|
||||
t.Errorf("got(-),want(+):\n%s", diff)
|
||||
}
|
||||
}
|
||||
version = runtime.Version
|
||||
}
|
||||
Reference in New Issue
Block a user