Commit d4b28605 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

internal: skip test with other group if user is only 1 group

Change-Id: I59a1f187ff4c88bcefdb1e70c6461ca4b2a79c3b
parent 672815b2
...@@ -53,18 +53,21 @@ func TestHasAccess(t *testing.T) { ...@@ -53,18 +53,21 @@ func TestHasAccess(t *testing.T) {
_ = myOtherGid _ = myOtherGid
_ = notMyGid _ = notMyGid
for i, tc := range []testcase{ cases := []testcase{
{myUid, myGid, myUid, myGid, 0100, 01, true}, {myUid, myGid, myUid, myGid, 0100, 01, true},
{myUid, myGid, myUid + 1, notMyGid, 0001, 0001, true}, {myUid, myGid, myUid + 1, notMyGid, 0001, 0001, true},
{myUid, myGid, myUid + 1, notMyGid, 0000, 0001, false}, {myUid, myGid, myUid + 1, notMyGid, 0000, 0001, false},
{myUid, myGid, myUid + 1, notMyGid, 0007, 0000, true}, {myUid, myGid, myUid + 1, notMyGid, 0007, 0000, true},
{myUid, myGid, myUid + 1, myOtherGid, 0020, 002, true},
{myUid, myGid, myUid + 1, notMyGid, 0020, 002, false}, {myUid, myGid, myUid + 1, notMyGid, 0020, 002, false},
{myUid, myGid, myUid, myGid, 0000, 01, false}, {myUid, myGid, myUid, myGid, 0000, 01, false},
{myUid, myGid, myUid, myGid, 0200, 01, false}, {myUid, myGid, myUid, myGid, 0200, 01, false},
{0, myGid, myUid + 1, notMyGid, 0700, 01, true}, {0, myGid, myUid + 1, notMyGid, 0700, 01, true},
} { }
if myOtherGid != 0 {
cases = append(cases, testcase{myUid, myGid, myUid + 1, myOtherGid, 0020, 002, true})
}
for i, tc := range cases {
got := HasAccess(tc.uid, tc.gid, tc.fuid, tc.fgid, tc.perm, tc.mask) got := HasAccess(tc.uid, tc.gid, tc.fuid, tc.fgid, tc.perm, tc.mask)
if got != tc.want { if got != tc.want {
t.Errorf("%d: accessCheck(%v): got %v, want %v", i, tc, got, tc.want) t.Errorf("%d: accessCheck(%v): got %v, want %v", i, tc, got, tc.want)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment