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

Function TestMasterKey_ToString

kms/keysource_test.go:375–408  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

373}
374
375func TestMasterKey_ToString(t *testing.T) {
376 dummyARNWithRole := fmt.Sprintf("%s+arn:aws:iam::my-role", dummyARN)
377
378 bar := "bar"
379 bam := "bam"
380 context := map[string]*string{
381 "foo": &bar,
382 "baz": &bam,
383 }
384
385 key := NewMasterKeyFromArn(dummyARN, nil, "")
386 assert.Equal(t, dummyARN, key.ToString())
387
388 key = NewMasterKeyFromArn(dummyARNWithRole, nil, "")
389 assert.Equal(t, dummyARNWithRole, key.ToString())
390
391 key = NewMasterKeyFromArn(dummyARN, nil, "profile")
392 assert.Equal(t, fmt.Sprintf("%s||profile", dummyARN), key.ToString())
393
394 key = NewMasterKeyFromArn(dummyARNWithRole, nil, "profile")
395 assert.Equal(t, fmt.Sprintf("%s||profile", dummyARNWithRole), key.ToString())
396
397 key = NewMasterKeyFromArn(dummyARN, context, "")
398 assert.Equal(t, fmt.Sprintf("%s|baz:bam,foo:bar", dummyARN), key.ToString())
399
400 key = NewMasterKeyFromArn(dummyARNWithRole, context, "")
401 assert.Equal(t, fmt.Sprintf("%s|baz:bam,foo:bar", dummyARNWithRole), key.ToString())
402
403 key = NewMasterKeyFromArn(dummyARN, context, "profile")
404 assert.Equal(t, fmt.Sprintf("%s|baz:bam,foo:bar|profile", dummyARN), key.ToString())
405
406 key = NewMasterKeyFromArn(dummyARNWithRole, context, "profile")
407 assert.Equal(t, fmt.Sprintf("%s|baz:bam,foo:bar|profile", dummyARNWithRole), key.ToString())
408}
409
410func TestMasterKey_ToMap(t *testing.T) {
411 value1 := "value1"

Callers

nothing calls this directly

Calls 2

NewMasterKeyFromArnFunction · 0.85
ToStringMethod · 0.65

Tested by

no test coverage detected