google: fix typos

Change-Id: I8fc92767c1ea73e731736056c72628977017301e
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/645775
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
Oleksandr Redko 2025-01-31 00:35:58 +02:00 committed by Gopher Robot
parent 9c82a8cf7a
commit 44967abe90
6 changed files with 14 additions and 14 deletions

View File

@ -263,7 +263,7 @@ const (
fileTypeJSON = "json" fileTypeJSON = "json"
) )
// Format contains information needed to retireve a subject token for URL or File sourced credentials. // Format contains information needed to retrieve a subject token for URL or File sourced credentials.
type Format struct { type Format struct {
// Type should be either "text" or "json". This determines whether the file or URL sourced credentials // Type should be either "text" or "json". This determines whether the file or URL sourced credentials
// expect a simple text subject token or if the subject token will be contained in a JSON object. // expect a simple text subject token or if the subject token will be contained in a JSON object.

View File

@ -347,12 +347,12 @@ func TestNonworkforceWithWorkforcePoolUserProject(t *testing.T) {
t.Fatalf("Expected error but found none") t.Fatalf("Expected error but found none")
} }
if got, want := err.Error(), "oauth2/google/externalaccount: Workforce pool user project should not be set for non-workforce pool credentials"; got != want { if got, want := err.Error(), "oauth2/google/externalaccount: Workforce pool user project should not be set for non-workforce pool credentials"; got != want {
t.Errorf("Incorrect error received.\nExpected: %s\nRecieved: %s", want, got) t.Errorf("Incorrect error received.\nExpected: %s\nReceived: %s", want, got)
} }
} }
func TestWorkforcePoolCreation(t *testing.T) { func TestWorkforcePoolCreation(t *testing.T) {
var audienceValidatyTests = []struct { var audienceValidityTests = []struct {
audience string audience string
expectSuccess bool expectSuccess bool
}{ }{
@ -371,7 +371,7 @@ func TestWorkforcePoolCreation(t *testing.T) {
} }
ctx := context.Background() ctx := context.Background()
for _, tt := range audienceValidatyTests { for _, tt := range audienceValidityTests {
t.Run(" "+tt.audience, func(t *testing.T) { // We prepend a space ahead of the test input when outputting for sake of readability. t.Run(" "+tt.audience, func(t *testing.T) { // We prepend a space ahead of the test input when outputting for sake of readability.
config := testConfig config := testConfig
config.TokenURL = "https://sts.googleapis.com" // Setting the most basic acceptable tokenURL config.TokenURL = "https://sts.googleapis.com" // Setting the most basic acceptable tokenURL

View File

@ -654,7 +654,7 @@ func TestRetrieveOutputFileSubjectTokenNotJSON(t *testing.T) {
if _, err = base.subjectToken(); err == nil { if _, err = base.subjectToken(); err == nil {
t.Fatalf("Expected error but found none") t.Fatalf("Expected error but found none")
} else if got, want := err.Error(), jsonParsingError(outputFileSource, "tokentokentoken").Error(); got != want { } else if got, want := err.Error(), jsonParsingError(outputFileSource, "tokentokentoken").Error(); got != want {
t.Errorf("Incorrect error received.\nExpected: %s\nRecieved: %s", want, got) t.Errorf("Incorrect error received.\nExpected: %s\nReceived: %s", want, got)
} }
_, deadlineSet := te.getDeadline() _, deadlineSet := te.getDeadline()
@ -801,7 +801,7 @@ func TestRetrieveOutputFileSubjectTokenFailureTests(t *testing.T) {
if _, err = ecs.subjectToken(); err == nil { if _, err = ecs.subjectToken(); err == nil {
t.Errorf("Expected error but found none") t.Errorf("Expected error but found none")
} else if got, want := err.Error(), tt.expectedErr.Error(); got != want { } else if got, want := err.Error(), tt.expectedErr.Error(); got != want {
t.Errorf("Incorrect error received.\nExpected: %s\nRecieved: %s", want, got) t.Errorf("Incorrect error received.\nExpected: %s\nReceived: %s", want, got)
} }
if _, deadlineSet := te.getDeadline(); deadlineSet { if _, deadlineSet := te.getDeadline(); deadlineSet {
@ -923,7 +923,7 @@ func TestRetrieveOutputFileSubjectTokenInvalidCache(t *testing.T) {
} }
if got, want := out, "tokentokentoken"; got != want { if got, want := out, "tokentokentoken"; got != want {
t.Errorf("Incorrect token received.\nExpected: %s\nRecieved: %s", want, got) t.Errorf("Incorrect token received.\nExpected: %s\nReceived: %s", want, got)
} }
}) })
} }
@ -1012,7 +1012,7 @@ func TestRetrieveOutputFileSubjectTokenJwt(t *testing.T) {
if out, err := ecs.subjectToken(); err != nil { if out, err := ecs.subjectToken(); err != nil {
t.Errorf("retrieveSubjectToken() failed: %v", err) t.Errorf("retrieveSubjectToken() failed: %v", err)
} else if got, want := out, "tokentokentoken"; got != want { } else if got, want := out, "tokentokentoken"; got != want {
t.Errorf("Incorrect token received.\nExpected: %s\nRecieved: %s", want, got) t.Errorf("Incorrect token received.\nExpected: %s\nReceived: %s", want, got)
} }
if _, deadlineSet := te.getDeadline(); deadlineSet { if _, deadlineSet := te.getDeadline(); deadlineSet {

View File

@ -72,7 +72,7 @@ func TestConfigFromJSON(t *testing.T) {
t.Errorf("ClientSecret = %q; want %q", got, want) t.Errorf("ClientSecret = %q; want %q", got, want)
} }
if got, want := conf.RedirectURL, "https://www.example.com/oauth2callback"; got != want { if got, want := conf.RedirectURL, "https://www.example.com/oauth2callback"; got != want {
t.Errorf("RedictURL = %q; want %q", got, want) t.Errorf("RedirectURL = %q; want %q", got, want)
} }
if got, want := strings.Join(conf.Scopes, ","), "scope1,scope2"; got != want { if got, want := strings.Join(conf.Scopes, ","), "scope1,scope2"; got != want {
t.Errorf("Scopes = %q; want %q", got, want) t.Errorf("Scopes = %q; want %q", got, want)

View File

@ -38,7 +38,7 @@ type testRefreshTokenServer struct {
server *httptest.Server server *httptest.Server
} }
func TestExernalAccountAuthorizedUser_JustToken(t *testing.T) { func TestExternalAccountAuthorizedUser_JustToken(t *testing.T) {
config := &Config{ config := &Config{
Token: "AAAAAAA", Token: "AAAAAAA",
Expiry: now().Add(time.Hour), Expiry: now().Add(time.Hour),
@ -57,7 +57,7 @@ func TestExernalAccountAuthorizedUser_JustToken(t *testing.T) {
} }
} }
func TestExernalAccountAuthorizedUser_TokenRefreshWithRefreshTokenInRespondse(t *testing.T) { func TestExternalAccountAuthorizedUser_TokenRefreshWithRefreshTokenInResponse(t *testing.T) {
server := &testRefreshTokenServer{ server := &testRefreshTokenServer{
URL: "/", URL: "/",
Authorization: "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=", Authorization: "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=",
@ -99,7 +99,7 @@ func TestExernalAccountAuthorizedUser_TokenRefreshWithRefreshTokenInRespondse(t
} }
} }
func TestExernalAccountAuthorizedUser_MinimumFieldsRequiredForRefresh(t *testing.T) { func TestExternalAccountAuthorizedUser_MinimumFieldsRequiredForRefresh(t *testing.T) {
server := &testRefreshTokenServer{ server := &testRefreshTokenServer{
URL: "/", URL: "/",
Authorization: "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=", Authorization: "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=",
@ -187,7 +187,7 @@ func TestExternalAccountAuthorizedUser_MissingRefreshFields(t *testing.T) {
}, },
}, },
{ {
name: "missing client secrect", name: "missing client secret",
config: Config{ config: Config{
RefreshToken: "BBBBBBBBB", RefreshToken: "BBBBBBBBB",
TokenURL: url, TokenURL: url,

View File

@ -142,7 +142,7 @@ func TestExchangeToken_Opts(t *testing.T) {
} }
strOpts, ok := data["options"] strOpts, ok := data["options"]
if !ok { if !ok {
t.Errorf("Server didn't recieve an \"options\" field.") t.Errorf("Server didn't receive an \"options\" field.")
} else if len(strOpts) < 1 { } else if len(strOpts) < 1 {
t.Errorf("\"options\" field has length 0.") t.Errorf("\"options\" field has length 0.")
} }