Пример #1
0
def test_claims_deser():
    pre = Claims(name={"essential": True}, nickname=None,
                   email={"essential": True},
                   email_verified={"essential": True}, picture=None)

    claims = claims_deser(pre.to_json(), format="json")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                               'picture'])

    claims = claims_deser(pre.to_dict(), format="dict")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                           'picture'])
Пример #2
0
def test_claims_deser_dict():
    pre = Claims(name={"essential": True}, nickname=None,
                 email={"essential": True},
                 email_verified={"essential": True}, picture=None)

    claims = claims_deser(pre.to_json(), sformat="json")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                               'picture'])

    claims = claims_deser(pre.to_dict(), sformat="dict")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                               'picture'])
Пример #3
0
def test_claims_deser():
    _dic = {
        "userinfo": {
            "given_name": {
                "essential": True
            },
            "nickname": None,
            "email": {
                "essential": True
            },
            "email_verified": {
                "essential": True
            },
            "picture": None,
            "http://example.info/claims/groups": None
        },
        "id_token": {
            "auth_time": {
                "essential": True
            },
            "acr": {
                "values": ["urn:mace:incommon:iap:silver"]
            }
        }
    }

    claims = claims_deser(json.dumps(_dic), sformat="json")
    assert _eq(claims.keys(), ["userinfo", "id_token"])
Пример #4
0
def test_claims_ser_json():
    claims = Claims(name={"essential": True}, nickname=None,
                    email={"essential": True},
                    email_verified={"essential": True}, picture=None)
    claims = claims_deser(claims_ser(claims, "json"), sformat="json")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                               'picture'])
Пример #5
0
def test_claims_deser_dict():
    pre = Claims(
        name={"essential": True},
        nickname=None,
        email={"essential": True},
        email_verified={"essential": True},
        picture=None,
    )

    claims = claims_deser(pre.to_json(), sformat="json")
    assert _eq(claims.keys(),
               ["name", "nickname", "email", "email_verified", "picture"])

    claims = claims_deser(pre.to_dict(), sformat="dict")
    assert _eq(claims.keys(),
               ["name", "nickname", "email", "email_verified", "picture"])
Пример #6
0
def test_claims_deser():
    _dic = {
        "userinfo": {
            "given_name": {"essential": True},
            "nickname": None,
            "email": {"essential": True},
            "email_verified": {"essential": True},
            "picture": None,
            "http://example.info/claims/groups": None
        },
        "id_token": {
            "auth_time": {"essential": True},
            "acr": {"values": ["urn:mace:incommon:iap:silver"]}
        }
    }

    claims = claims_deser(json.dumps(_dic), sformat="json")
    assert _eq(claims.keys(), ["userinfo", "id_token"])
Пример #7
0
def test_claims_ser_urlencoded():
    claims = claims_deser(claims_ser(CLAIMS, "urlencoded"), format="urlencoded")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                               'picture'])
Пример #8
0
def test_claims_ser_json():
    claims = claims_deser(claims_ser(CLAIMS, "json"), format="json")
    assert _eq(claims.keys(), ['name', 'nickname', 'email', 'email_verified',
                           'picture'])
Пример #9
0
def test_claims_ser_json():
    claims = claims_deser(claims_ser(CLAIMS, "json"), sformat="json")
    assert _eq(claims.keys(),
               ['name', 'nickname', 'email', 'email_verified', 'picture'])