gateway/tests/unit/rbac
2025-12-15 21:55:26 +01:00
..
__init__.py refactored service center 2025-12-15 21:55:26 +01:00
README.md refactored uam to rbac 2025-12-07 13:48:39 +01:00
test_rbac_bootstrap.py refactored service center 2025-12-15 21:55:26 +01:00
test_rbac_permissions.py refactored service center 2025-12-15 21:55:26 +01:00

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

# 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