Implement audited lost-factor recovery and track remaining P04 acceptance
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a092fe-13b1-7f12-ac74-7d258af4d79c
This commit is contained in:
parent
0c4db1ef0b
commit
9575b51d6e
3 changed files with 119 additions and 0 deletions
13
tests/test_keycape_factor_recovery.py
Normal file
13
tests/test_keycape_factor_recovery.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import importlib.util,sys,unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts'))
|
||||
import keycape_factor_recovery as m
|
||||
class OwnerRecoveryTests(unittest.TestCase):
|
||||
def test_actor_comes_from_authenticated_entity(self):
|
||||
with patch.object(m,'call',return_value={'data':{'policies':['platform-admin'],'entity_id':'11111111-1111-1111-1111-111111111111'}}):
|
||||
self.assertEqual(m.owner_identity(),'openbao:11111111-1111-1111-1111-111111111111')
|
||||
def test_reader_or_missing_entity_cannot_run_recovery(self):
|
||||
for data in [{'policies':['workload-kv-read-keycape-factor-read'],'entity_id':'11111111-1111-1111-1111-111111111111'},{'policies':['root'],'entity_id':''},{'policies':['root'],'entity_id':'11111111-1111-1111-1111-111111111111'}]:
|
||||
with patch.object(m,'call',return_value={'data':data}):
|
||||
with self.assertRaises(ValueError):m.owner_identity()
|
||||
Loading…
Add table
Add a link
Reference in a new issue