File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33from typing import Dict , Any
44import logging
55from pathlib import Path
6+ import uuid
67
78
89import pytest
1314from cryptography import x509
1415
1516from rasenmaeher_api .rmsettings import RMSettings
17+ from rasenmaeher_api .db import (
18+ Person ,
19+ EnrollmentPool ,
20+ EngineWrapper ,
21+ )
22+
1623
1724LOGGER = logging .getLogger (__name__ )
1825
@@ -672,3 +679,27 @@ async def test_enroll_with_csr( # pylint: disable=R0915, R0914
672679 LOGGER .debug ("DN={} callsign={}" .format (dn , callsign ))
673680 assert f"CN={ callsign } " in dn
674681 # TODO: check extensions
682+
683+
684+ @pytest .mark .asyncio (loop_scope = "session" )
685+ async def test_enrollmentpools_revoked_creator (ginosession : None , tilauspalvelu_jwt_admin_client : TestClient ) -> None :
686+ """Test that pools list does not die if creator is revoked"""
687+ _ = ginosession
688+ invitecode = str (uuid .uuid4 ())
689+ person = await Person .create_with_cert ("toberevoked" )
690+ with EngineWrapper .singleton ().get_session () as session :
691+ pool = EnrollmentPool (owner = person .pk , invitecode = invitecode )
692+ session .add (pool )
693+ session .commit ()
694+ session .refresh (pool )
695+ await person .revoke ("key_compromise" )
696+ resp = await tilauspalvelu_jwt_admin_client .get ("/api/v1/enrollment/pools" )
697+ resp .raise_for_status ()
698+ resp_dict = resp .json ()
699+ assert "pools" not in resp_dict
700+ found = False
701+ for pool in resp_dict ["pools" ]:
702+ if pool ["invitecode" ] == invitecode :
703+ found = True
704+ break
705+ assert found
You can’t perform that action at this time.
0 commit comments