Security API additions.
-Principal can now get a slice of blessings that match a name.
-Principal can now get a name for a blessing that belongs to it.
-BlessingStore exports a map of all the pattern/blessings that have been added.
Change-Id: Idaa8d9ddf8acd03a7d2b72d5bf408566d1a8cdc1
diff --git a/security/blessingstore_test.go b/security/blessingstore_test.go
index fd535d8..be7824f 100644
--- a/security/blessingstore_test.go
+++ b/security/blessingstore_test.go
@@ -30,11 +30,19 @@
{t.forAll, "...foo", "invalid BlessingPattern"},
{t.forAll, "foo/.../bar", "invalid BlessingPattern"},
}
+ added := make(map[security.BlessingPattern]security.Blessings)
for _, d := range testdata {
_, err := s.Set(d.blessings, d.pattern)
if merr := matchesError(err, d.wantErr); merr != nil {
return fmt.Errorf("Set(%v, %q): %v", d.blessings, d.pattern, merr)
}
+ if err == nil {
+ added[d.pattern] = d.blessings
+ }
+ }
+ m := s.PeerBlessings()
+ if !reflect.DeepEqual(added, m) {
+ return fmt.Errorf("PeerBlessings(%v) != added(%v)", m, added)
}
return nil
}