File: test_72_eptid.py

package info (click to toggle)
python-pysaml2 4.5.0-4%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,664 kB
  • sloc: xml: 229,124; python: 61,007; makefile: 160; sh: 107
file content (41 lines) | stat: -rw-r--r-- 1,209 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from saml2.eptid import Eptid, EptidShelve

__author__ = 'rolandh'


def test_eptid():
    edb = Eptid("secret")
    e1 = edb.get("idp_entity_id", "sp_entity_id", "user_id", "some other data")
    print(e1)
    assert e1.startswith("idp_entity_id!sp_entity_id!")
    e2 = edb.get("idp_entity_id", "sp_entity_id", "user_id", "some other data")
    assert e1 == e2

    e3 = edb.get("idp_entity_id", "sp_entity_id", "user_2", "some other data")
    print(e3)
    assert e1 != e3

    e4 = edb.get("idp_entity_id", "sp_entity_id2", "user_id", "some other data")
    assert e4 != e1
    assert e4 != e3


def test_eptid_shelve():
    edb = EptidShelve("secret", "eptid.db")
    e1 = edb.get("idp_entity_id", "sp_entity_id", "user_id", "some other data")
    print(e1)
    assert e1.startswith("idp_entity_id!sp_entity_id!")
    e2 = edb.get("idp_entity_id", "sp_entity_id", "user_id", "some other data")
    assert e1 == e2

    e3 = edb.get("idp_entity_id", "sp_entity_id", "user_2", "some other data")
    print(e3)
    assert e1 != e3

    e4 = edb.get("idp_entity_id", "sp_entity_id2", "user_id", "some other data")
    assert e4 != e1
    assert e4 != e3


if __name__ == "__main__":
    test_eptid_shelve()