17 lines
464 B
Python
17 lines
464 B
Python
import pytest
|
|
|
|
from gitea_dynamic_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)
|