Skip to content

Commit

Permalink
auth: remove TestRoleGrantPermissionRevision unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcong committed Mar 22, 2020
1 parent 3d67756 commit e68e736
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions auth/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,54 +414,6 @@ func TestListUsers(t *testing.T) {
}
}

func TestRoleGrantPermissionRevision(t *testing.T) {
as, tearDown := setupAuthStore(t)
defer tearDown(t)

_, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "role-test-1"})
if err != nil {
t.Fatal(err)
}

perm := &authpb.Permission{
PermType: authpb.WRITE,
Key: []byte("Keys"),
RangeEnd: []byte("RangeEnd"),
}
_, err = as.RoleGrantPermission(&pb.AuthRoleGrantPermissionRequest{
Name: "role-test-1",
Perm: perm,
})

if err != nil {
t.Fatal(err)
}

r, err := as.RoleGet(&pb.AuthRoleGetRequest{Role: "role-test-1"})
if err != nil {
t.Fatal(err)
}

if !reflect.DeepEqual(perm, r.Perm[0]) {
t.Errorf("expected %v, got %v", perm, r.Perm[0])
}

oldRevision := as.Revision()

_, err = as.RoleGrantPermission(&pb.AuthRoleGrantPermissionRequest{
Name: "role-test-1",
Perm: perm,
})

if err != nil {
t.Error(err)
}
newRevision := as.Revision()

if oldRevision != newRevision {
t.Errorf("expected revision diff is 0, got %d", newRevision-oldRevision)
}
}

func TestRoleGrantPermission(t *testing.T) {
as, tearDown := setupAuthStore(t)
Expand Down

0 comments on commit e68e736

Please sign in to comment.