def test1(self): db = SqlDb(DB_URI) cs = KvSqlChallengeStore(db) t1 = cs.timestamp("somechallenge") self.assertIsNone(t1) t2 = datetime.datetime.now() cs.store("somechallenge", t2) t3 = cs.timestamp("somechallenge") self.assertEqual(t2.timetuple(), t3.timetuple())
def test2(self): db = SqlDb(DB_URI) cs = KvSqlChallengeStore(db) t = cs.timestamp("non-existing-challenge") self.assertIsNone(t) cs.store("non-existing-challenge", datetime.datetime.now()) t = cs.timestamp("non-existing-challenge") self.assertIsNotNone(t) cs.purge("non-existing-challenge") t = cs.timestamp("non-existing-challenge") self.assertIsNone(t)