Files
gitea-dynamic-runner/tests/test_jwt_broker.py
T
panxiao81 7c3cd6a921
test / python (pull_request) Successful in 8s
test / shell (pull_request) Successful in 17s
添加嵌套 CI 的 SPIRE JWT broker
2026-09-16 13:37:40 +00:00

17 lines
464 B
Python

import pytest
from gitea_microvm_runner.jwt_broker import extract_svid
def test_extract_svid_from_spire_json():
assert extract_svid([
{"svids": [{"hint": "", "spiffe_id": "spiffe://example/ci", "svid": "jwt"}]},
{"bundles": {}},
]) == "jwt"
@pytest.mark.parametrize("document", [{}, [], [{"bundles": {}}]])
def test_extract_svid_rejects_unexpected_response(document):
with pytest.raises(ValueError):
extract_svid(document)