def test_grant_from_token(): token = "{}.{}.{}".format( b64encode("sysrole".encode()).decode(), b64encode("system".encode()).decode(), b64encode("view".encode()).decode(), ) grant = Grant.from_token(token) dict_ = {"subject": "sysrole", "id": "system", "level": "view"} assert grant.to_dict() == dict_
def test_grant_to_and_from_token(): dict_ = {"subject": "sysrole", "id": "system", "level": "view"} grant = Grant.from_dict(dict_) assert Grant.from_token(grant.to_token()) == grant