Exemplo n.º 1
0
    def test_forget(self):
        log_id_1 = 'C0FE' * 16

        # 1. Configure public key (new entry)
        ctlogconfig.configure_public_key(self.cur, [public_key_file_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 1)
        ctlogconfig.forget_log(self.cur, ['#1'])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 0)

        # 2. Distrust a log (new entry)
        ctlogconfig.distrust_log(self.cur, [log_id_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 1)
        self.assertEqual(recs[0].log_id, log_id_1)

        ctlogconfig.forget_log(self.cur, [log_id_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 0)
Exemplo n.º 2
0
 def test_key_configuration(self):
     # 1. Configure public key (new entry)
     ctlogconfig.configure_public_key(self.cur, [public_key_file_1])
     recs = ctlogconfig.dump_ll(self.cur)
     self.assertEqual(len(recs), 1)
     rec = recs[0]
     self.assertEqual(rec.id, 1)
     self.assertEqual(rec.log_id, None)
     self.assertEqual(rec.public_key, public_key_file_1)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, None)
     # 2. update public key of existing record
     ctlogconfig.configure_public_key(self.cur, ['#1', public_key_file_2])
     recs = ctlogconfig.dump_ll(self.cur)
     self.assertEqual(len(recs), 1)
     rec = recs[0]
     self.assertEqual(rec.id, 1)
     self.assertEqual(rec.public_key, public_key_file_2)
Exemplo n.º 3
0
    def test_forget(self):
        log_id_1 = 'C0FE' * 16

        # 1. Configure public key (new entry)
        ctlogconfig.configure_public_key(self.cur,
                                         [public_key_file_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 1)
        ctlogconfig.forget_log(self.cur, ['#1'])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 0)

        # 2. Distrust a log (new entry)
        ctlogconfig.distrust_log(self.cur, [log_id_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 1)
        self.assertEqual(recs[0].log_id, log_id_1)

        ctlogconfig.forget_log(self.cur, [log_id_1])
        recs = ctlogconfig.dump_ll(self.cur)
        self.assertEqual(len(recs), 0)
Exemplo n.º 4
0
 def test_key_configuration(self):
     # 1. Configure public key (new entry)
     ctlogconfig.configure_public_key(self.cur,
                                      [public_key_file_1])
     recs = ctlogconfig.dump_ll(self.cur)
     self.assertEqual(len(recs), 1)
     rec = recs[0]
     self.assertEqual(rec.id, 1)
     self.assertEqual(rec.log_id, None)
     self.assertEqual(rec.public_key, public_key_file_1)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, None)
     # 2. update public key of existing record
     ctlogconfig.configure_public_key(self.cur,
                                      ['#1', public_key_file_2])
     recs = ctlogconfig.dump_ll(self.cur)
     self.assertEqual(len(recs), 1)
     rec = recs[0]
     self.assertEqual(rec.id, 1)
     self.assertEqual(rec.public_key, public_key_file_2)