google: fixing more nits

Change-Id: Ie637113fa2363a40e05f51345efbd87d22bfe54a
This commit is contained in:
Patrick Jones
2020-12-17 11:26:51 -08:00
parent 08114d04f5
commit 80e2eea187
4 changed files with 66 additions and 58 deletions

View File

@@ -1,3 +1,7 @@
// Copyright 2020 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 (
@@ -14,38 +18,37 @@ var testFileConfig = Config{
ClientID: "rbrgnognrhongo3bi4gb9ghg9g",
}
type fsTest struct {
name string
cs CredentialSource
want string
}
var testFsUntyped = fsTest{
name: "UntypedFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.txt",
},
want: "street123",
}
var testFsTypeText = fsTest{
name: "TextFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.txt",
Format: format{Type: fileTypeText},
},
want: "street123",
}
var testFsTypeJSON = fsTest{
name: "JSONFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.json",
Format: format{Type: fileTypeJSON, SubjectTokenFieldName: "SubjToken"},
},
want: "321road",
}
var fileSourceTests = []fsTest{testFsUntyped, testFsTypeText, testFsTypeJSON}
func TestRetrieveFileSubjectToken(t *testing.T) {
var fileSourceTests = []struct {
name string
cs CredentialSource
want string
}{
{
name: "UntypedFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.txt",
},
want: "street123",
},
{
name: "TextFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.txt",
Format: format{Type: fileTypeText},
},
want: "street123",
},
{
name: "JSONFileSource",
cs: CredentialSource{
File: "./testdata/3pi_cred.json",
Format: format{Type: fileTypeJSON, SubjectTokenFieldName: "SubjToken"},
},
want: "321road",
},
}
for _, test := range fileSourceTests {
tfc := testFileConfig
tfc.CredentialSource = test.cs