gateway/tests/unit/rbac
2026-04-19 00:04:03 +02: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 fix: RBAC bootstrap anthropic for user, FeatureAccess response, workspace UI repair, user access overview, RBAC tests 2026-03-23 10:29:23 +01:00
test_rbac_permissions.py fix: RBAC bootstrap anthropic for user, FeatureAccess response, workspace UI repair, user access overview, RBAC tests 2026-03-23 10:29:23 +01:00
test_sysadmin_migration.py fixed proper splitting sysadmin/platformadmin and proper logic for mandate name(slug) and label(user) 2026-04-19 00:04:03 +02: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