47 lines
1.1 KiB
Markdown
47 lines
1.1 KiB
Markdown
# RBAC Unit Tests
|
|
|
|
Unit tests for the Role-Based Access Control (RBAC) system.
|
|
|
|
## Test Files
|
|
|
|
### `test_rbac_permissions.py`
|
|
Tests RBAC permission resolution logic:
|
|
- Single role with generic rules
|
|
- Rule specificity (most specific wins)
|
|
- Multiple roles with union logic
|
|
- View permission overrides
|
|
- No roles scenario
|
|
- Finding most specific rules
|
|
- Opening rights validation
|
|
- UI and RESOURCE context handling
|
|
|
|
### `test_rbac_bootstrap.py`
|
|
Tests RBAC bootstrap initialization:
|
|
- Root mandate creation
|
|
- Admin user creation with sysadmin role
|
|
- Event user creation with sysadmin role
|
|
- Default role rules creation
|
|
- Table-specific rules creation
|
|
- Rule initialization skipping when rules exist
|
|
|
|
## Running Tests
|
|
|
|
```bash
|
|
# Run all RBAC unit tests
|
|
pytest tests/unit/rbac/
|
|
|
|
# Run specific test file
|
|
pytest tests/unit/rbac/test_rbac_permissions.py
|
|
|
|
# Run with verbose output
|
|
pytest tests/unit/rbac/ -v
|
|
```
|
|
|
|
## Test Coverage
|
|
|
|
- Permission resolution algorithms
|
|
- Rule specificity logic
|
|
- Multiple role combination (union logic)
|
|
- Access rule validation
|
|
- Bootstrap initialization
|
|
- Default rule creation
|