Exemplo n.º 1
0
 def test_url_configuration(self):
     # 1. initial definition
     test_url_1 = 'https://log.example.com/foo'
     test_url_2 = test_url_1 + 'XX'
     ctlogconfig.configure_url(self.cur, [test_url_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, None)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, test_url_1)
     # 2. update URL of existing record
     ctlogconfig.configure_url(self.cur, ['#1', test_url_2])
     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, None)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, test_url_2)
Exemplo n.º 2
0
 def test_url_configuration(self):
     # 1. initial definition
     test_url_1 = 'https://log.example.com/foo'
     test_url_2 = test_url_1 + 'XX'
     ctlogconfig.configure_url(self.cur, [test_url_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, None)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, test_url_1)
     # 2. update URL of existing record
     ctlogconfig.configure_url(self.cur, ['#1', test_url_2])
     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, None)
     self.assertEqual(rec.distrusted, None)
     self.assertEqual(rec.min_valid_timestamp, None)
     self.assertEqual(rec.max_valid_timestamp, None)
     self.assertEqual(rec.url, test_url_2)
Exemplo n.º 3
0
    def test_url_by_log_id_configuration(self):
        test_url_1 = 'https://log.example.com/foo'
        log_id_1 = 'C0FE' * 16
        ctlogconfig.configure_url(self.cur, [log_id_1, test_url_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, log_id_1)
        self.assertEqual(rec.public_key, None)
        self.assertEqual(rec.distrusted, None)
        self.assertEqual(rec.min_valid_timestamp, None)
        self.assertEqual(rec.max_valid_timestamp, None)
        self.assertEqual(rec.url, test_url_1)

        # ctauditscts should be able to query it like this:
        stmt = 'SELECT * FROM loginfo WHERE log_id = ?'
        self.cur.execute(stmt, [log_id_1])
        recs = list(self.cur.fetchall())
        self.assertEqual(len(recs), 1)
        rec = recs[0]
        self.assertEqual(rec[1], log_id_1)
        self.assertEqual(rec[6], test_url_1)
Exemplo n.º 4
0
    def test_url_by_log_id_configuration(self):
        test_url_1 = 'https://log.example.com/foo'
        log_id_1 = 'C0FE' * 16
        ctlogconfig.configure_url(self.cur, [log_id_1, test_url_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, log_id_1)
        self.assertEqual(rec.public_key, None)
        self.assertEqual(rec.distrusted, None)
        self.assertEqual(rec.min_valid_timestamp, None)
        self.assertEqual(rec.max_valid_timestamp, None)
        self.assertEqual(rec.url, test_url_1)

        # ctauditscts should be able to query it like this:
        stmt = 'SELECT * FROM loginfo WHERE log_id = ?'
        self.cur.execute(stmt, [log_id_1])
        recs = list(self.cur.fetchall())
        self.assertEqual(len(recs), 1)
        rec = recs[0]
        self.assertEqual(rec[1], log_id_1)
        self.assertEqual(rec[6], test_url_1)