apache / apache/casbin

[feature] Add lightweight authorization test helpers

Open
#1,624 2 comments 1 reaction 1 assignee Claimed by @nodece View on GitHub
enhancement
Dominant language
Go
Stars
20.4k
Forks
1.8k
Avg merge
5d 11h
Merged PRs (30d)
2

Description

## Background

Testing authorization behavior with Casbin often results in repetitive `Enforce` assertions with limited failure context.

### Proposal

Introduce a small set of authorization test helper functions as an external package.

Example:

```go
authztest.AssertAllow(t, e, "alice", "data1", "read")
authztest.AssertDeny(t, e, "bob", "data1", "write")
```

### Design Notes

* Helpers are thin wrappers around `Enforce`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.