MCPcopy
hub / github.com/getsops/sops / TestMasterKeysFromResourceIDString

Function TestMasterKeysFromResourceIDString

gcpkms/keysource_test.go:28–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func 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
43func TestTokenSource_ApplyToMasterKey(t *testing.T) {
44 src := NewTokenSource(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: "some-token"}))

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected