MCPcopy Create free account
hub / github.com/docker/cli / TestGetSignerRolesWithKeyIDs

Function TestGetSignerRolesWithKeyIDs

cmd/docker-trust/trust/inspect_pretty_test.go:360–412  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

358}
359
360func TestGetSignerRolesWithKeyIDs(t *testing.T) {
361 roles := []data.Role{
362 {
363 RootRole: data.RootRole{
364 KeyIDs: []string{"key11"},
365 },
366 Name: "targets/alice",
367 },
368 {
369 RootRole: data.RootRole{
370 KeyIDs: []string{"key21", "key22"},
371 },
372 Name: "targets/releases",
373 },
374 {
375 RootRole: data.RootRole{
376 KeyIDs: []string{"key31"},
377 },
378 Name: data.CanonicalTargetsRole,
379 },
380 {
381 RootRole: data.RootRole{
382 KeyIDs: []string{"key41", "key01"},
383 },
384 Name: data.CanonicalRootRole,
385 },
386 {
387 RootRole: data.RootRole{
388 KeyIDs: []string{"key51"},
389 },
390 Name: data.CanonicalSnapshotRole,
391 },
392 {
393 RootRole: data.RootRole{
394 KeyIDs: []string{"key61"},
395 },
396 Name: data.CanonicalTimestampRole,
397 },
398 {
399 RootRole: data.RootRole{
400 KeyIDs: []string{"key71", "key72"},
401 },
402 Name: "targets/bob",
403 },
404 }
405 expectedSignerRoleToKeyIDs := map[string][]string{
406 "alice": {"key11"},
407 "bob": {"key71", "key72"},
408 }
409
410 signerRoleToKeyIDs := getDelegationRoleToKeyMap(roles)
411 assert.Check(t, is.DeepEqual(expectedSignerRoleToKeyIDs, signerRoleToKeyIDs))
412}
413
414func TestFormatAdminRole(t *testing.T) {
415 aliceRole := data.Role{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…