Skip to content

Commit f888c3f

Browse files
committed
tests: added test
1 parent 61b93fd commit f888c3f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from pyeudiw.trust.anchors_loader import AnchorsLoader
2+
from pyeudiw.storage.db_engine import DBEngine
3+
from pyeudiw.storage.exceptions import EntryNotFound
4+
from pyeudiw.tests.settings import CONFIG
5+
from pyeudiw.tests.federation.base import ta_ec_signed
6+
from pyeudiw.tests.x509.test_x509 import gen_chain
7+
from ssl import DER_cert_to_PEM_cert
8+
9+
def test_load_anchors():
10+
db = DBEngine(CONFIG["storage"])
11+
12+
pem = DER_cert_to_PEM_cert(gen_chain()[-1])
13+
14+
anchors = [
15+
{
16+
"entity_id": "entity",
17+
"federation": {
18+
"entity_configuration": ta_ec_signed
19+
},
20+
"x509": {
21+
"pem": pem
22+
}
23+
}
24+
]
25+
26+
AnchorsLoader.load_anchors(db, anchors)
27+
28+
entity = db.get_trust_anchor("entity")
29+
30+
assert "entity_id" in entity
31+
assert "federation" in entity
32+
assert "entity_configuration" in entity["federation"]
33+
34+
assert "x509" in entity
35+
assert "pem" in entity["x509"]

0 commit comments

Comments
 (0)