Skip to content

Commit a7bf0d4

Browse files
committed
fix: set CASBIN_AUTO_LOAD_POLICY_INTERVAL to 0 and enable auto-save in tests
1 parent cf6f1de commit a7bf0d4

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

openedx_authz/settings/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ def plugin_settings(settings): # pylint: disable=unused-argument
6969

7070
# Casbin configuration
7171
CASBIN_MODEL = os.path.join(ROOT_DIRECTORY, "engine", "config", "model.conf")
72-
CASBIN_AUTO_LOAD_POLICY_INTERVAL = 0.5
72+
CASBIN_AUTO_LOAD_POLICY_INTERVAL = 0

openedx_authz/tests/api/test_roles.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def setUpClass(cls):
9494
"""
9595
super().setUpClass()
9696
AuthzEnforcer.get_enforcer().stop_auto_load_policy()
97+
# Enable auto-save to ensure policies are saved to the database
98+
# This is necessary because the tests are not using auto-load policy
99+
AuthzEnforcer.get_enforcer().enable_auto_save(True)
97100
cls._seed_database_with_policies()
98101

99102
def setUp(self):

0 commit comments

Comments
 (0)