(t *testing.T)
| 358 | } |
| 359 | |
| 360 | func 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 | |
| 414 | func TestFormatAdminRole(t *testing.T) { |
| 415 | aliceRole := data.Role{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…