mirror of https://github.com/status-im/consul.git
acl: more keyring tests
This commit is contained in:
parent
7e50a457d9
commit
02b49058a2
|
@ -245,6 +245,7 @@ func TestPolicyACL(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Test the events
|
||||
type eventcase struct {
|
||||
inp string
|
||||
read bool
|
||||
|
@ -369,3 +370,30 @@ func TestPolicyACL_Parent(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPolicyACL_Keyring(t *testing.T) {
|
||||
// Test keyring ACLs
|
||||
type keyringcase struct {
|
||||
inp string
|
||||
read bool
|
||||
write bool
|
||||
}
|
||||
keyringcases := []keyringcase{
|
||||
{"", false, false},
|
||||
{KeyringPolicyRead, true, false},
|
||||
{KeyringPolicyWrite, true, true},
|
||||
{KeyringPolicyDeny, false, false},
|
||||
}
|
||||
for _, c := range keyringcases {
|
||||
acl, err := New(DenyAll(), &Policy{Keyring: c.inp})
|
||||
if err != nil {
|
||||
t.Fatalf("bad: %s", err)
|
||||
}
|
||||
if acl.KeyringRead() != c.read {
|
||||
t.Fatalf("bad: %#v", c)
|
||||
}
|
||||
if acl.KeyringWrite() != c.write {
|
||||
t.Fatalf("bad: %#v", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue