(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestMasterKeysFromResourceIDString(t *testing.T) { |
| 29 | s := "projects/sops-testing1/locations/global/keyRings/creds/cryptoKeys/key1, projects/sops-testing2/locations/global/keyRings/creds/cryptoKeys/key2" |
| 30 | ks := MasterKeysFromResourceIDString(s) |
| 31 | k1 := ks[0] |
| 32 | k2 := ks[1] |
| 33 | expectedResourceID1 := "projects/sops-testing1/locations/global/keyRings/creds/cryptoKeys/key1" |
| 34 | expectedResourceID2 := "projects/sops-testing2/locations/global/keyRings/creds/cryptoKeys/key2" |
| 35 | if k1.ResourceID != expectedResourceID1 { |
| 36 | t.Errorf("ResourceID mismatch. Expected %s, found %s", expectedResourceID1, k1.ResourceID) |
| 37 | } |
| 38 | if k2.ResourceID != expectedResourceID2 { |
| 39 | t.Errorf("ResourceID mismatch. Expected %s, found %s", expectedResourceID2, k2.ResourceID) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | func TestTokenSource_ApplyToMasterKey(t *testing.T) { |
| 44 | src := NewTokenSource(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "some-token"})) |
nothing calls this directly
no test coverage detected