| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func blessSelf(p security.Principal, name string) security.Blessings { |
| b, err := p.BlessSelf(name) |
| func matchesError(got error, want string) error { |
| if (got == nil) && len(want) == 0 { |
| return fmt.Errorf("Got nil error, wanted to match %q", want) |
| if !strings.Contains(got.Error(), want) { |
| return fmt.Errorf("Got error %q, wanted to match %q", got, want) |
| func matchesErrorID(got error, want verror.ID) error { |
| if (got == nil) && len(want) == 0 { |
| return fmt.Errorf("Got nil error, wanted to match %q", want) |
| if verror.ErrorID(got) != want { |
| return fmt.Errorf("Got error %q, wanted to match %q", got, want) |