Skip to content

Commit

Permalink
test: adds test for acl (#14956)
Browse files Browse the repository at this point in the history
Signed-off-by: ChaitanyaD48 <[email protected]>
Signed-off-by: Chaitanya Deshmukh <[email protected]>
  • Loading branch information
ChaitanyaD48 authored Jan 25, 2024
1 parent f95dcbc commit 5611de3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions go/acl/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ func TestSimplePolicy(t *testing.T) {
err = CheckAccessActor("", DEBUGGING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessActor("", MONITORING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessHTTP(nil, ADMIN)
assert.Equalf(t, err.Error(), want, "got %v, want %s", err, want)

err = CheckAccessHTTP(nil, DEBUGGING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessHTTP(nil, MONITORING)
assert.Equalf(t, err, nil, "got %v, want no error", err)
}

func TestEmptyPolicy(t *testing.T) {
Expand All @@ -78,11 +83,17 @@ func TestEmptyPolicy(t *testing.T) {
err = CheckAccessActor("", DEBUGGING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessActor("", MONITORING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessHTTP(nil, ADMIN)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessHTTP(nil, DEBUGGING)
assert.Equalf(t, err, nil, "got %v, want no error", err)

err = CheckAccessHTTP(nil, MONITORING)
assert.Equalf(t, err, nil, "got %v, want no error", err)
}

func TestValidSecurityPolicy(t *testing.T) {
Expand Down

0 comments on commit 5611de3

Please sign in to comment.