def test_from_json(self): dic = {'uid': 'uid', 'salt': 'salt', 'authn_time': 1000, 'valid_until': 1500} ae = AuthnEvent.from_json(json.dumps(dic)) assert ae.uid == 'uid' assert ae.salt == 'salt' assert ae.authn_time == 1000 assert ae.valid_until == 1500
def test_sub_to_authn_event(self): ae = AuthnEvent("sub", "salt", time_stamp=time.time()) sid = self.sdb.create_authz_session(ae, AREQ) sub = self.sdb.do_sub(sid, "client_salt") # given the sub find out whether the authn event is still valid sids = self.sdb.get_sids_by_sub(sub) ae = self.sdb[sids[0]]["authn_event"] assert AuthnEvent.from_json(ae).valid()
def test_from_json(self): dic = { "uid": "uid", "salt": "salt", "authn_time": 1000, "valid_until": 1500 } ae = AuthnEvent.from_json(json.dumps(dic)) assert ae.uid == "uid" assert ae.salt == "salt" assert ae.authn_time == 1000 assert ae.valid_until == 1500