-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
executable file
·49 lines (35 loc) · 4.56 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python3
"""
Unit tests for tlsa_rdata
"""
import unittest
from tlsa_rdata import get_hexdata
class TestRdata(unittest.TestCase):
def setUp(self):
self.pemfile = "testcert.pem"
def test_0_0(self):
rdata = get_hexdata(self.pemfile, 0, 0)
self.assertEqual(rdata,
"3082052030820408a003020102021203a410c0598159a5ed9228c45e3bcd10829f300d06092a864886f70d01010b05003032310b300906035504061302555331163014060355040a130d4c6574277320456e6372797074310b3009060355040313025233301e170d3231303331343130323133335a170d3231303631323130323133335a3018311630140603550403130d7777772e68757175652e636f6d30820122300d06092a864886f70d01010105000382010f003082010a0282010100da64a368e153f415098d80f88d0c451e4f3e82f7829554519ff6d525e19e9f3a2b777a393b21f509ad2700c815c55bef29fdc4b1454bf5bc3a75f9ec4be01af8445fa441adfd0b3bc0eae72242f856ed1a810f95a34b65b6c5cff355e4893eb27f0abb7462d22ec7e291215fc75ba84bfdf60a802a342489a885ebc13b6ffc192993b8ab715b4956bb58d0fe9def81d34114a983749460212a21af1543656b633433ed9611f958bc5b8241a442798d291e9f84b6b0a40a6c71fbb73f16beb749025c2947d986fbf0446385cc1799cfc686a95362caddc3481a3f4085f3a418d3c8d5d38a85681d47a87d870d7cdff2f12d39a1b148e43fb5a3fb37c16d4c880d0203010001a382024830820244300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff04023000301d0603551d0e04160414a2e706bd2f24bd5d8b9895ae5ac8ea65859219b3301f0603551d23041830168014142eb317b75856cbae500940e61faf9d8b14c2c6305506082b0601050507010104493047302106082b060105050730018615687474703a2f2f72332e6f2e6c656e63722e6f7267302206082b060105050730028616687474703a2f2f72332e692e6c656e63722e6f72672f30180603551d110411300f820d7777772e68757175652e636f6d304c0603551d20044530433008060667810c0102013037060b2b0601040182df130101013028302606082b06010505070201161a687474703a2f2f6370732e6c657473656e63727970742e6f726730820104060a2b06010401d6790204020481f50481f200f00076006f5376ac31f03119d89900a45115ff77151c11d902c10029068db2089a37d9130000017830784c1a0000040300473045022100a6717dbb2e331a1555f224136880e6b43d434ffc165a37bc9e3d52da23d417ef02205557f163fc2c5d13827e472f900a6db27c14b43941281b1dd2fd0fadfc7a24c0007600f65c942fd1773022145418083094568ee34d131933bfdf0c2f200bcc4ef164e30000017830784bea00000403004730450221009f062449c6d2815915cb55c2f53818316752a08b8880daeab940d27eb86392160220406e2e0df3dbdab54bff703b099aa576629b2dd4d41791ccbed8be784e47bf84300d06092a864886f70d01010b050003820101000d1e219ea3800c2d8d9ebfd32030facac5c700e21984909354cbc2cad93fe871124d86fd2e1965f48eba0ab4a6d71e6db28d708ef361a331120c9db5f434bb2136459cba838f6df387804818f5dd6a71202940e9e28088ae32798c9420ffdf5ec5b717c7c267a7e5edd1b63a6add65c7860f3a15e6fbbac49aa200779d90ad4a0923814d8ffa2c763541f6c41a680dee31a5ce6f9e580ee3d8da9b127bac1601f6f39d537a46664a3a5c9e3d3c699ea36e09c5ff15604fdc0355d2631adb1c054b5a2042069adf9aa3db4d58d2975286772b3c1e195a3d8d561fcfb27a1ecae5e17d124df4eec4f8baf25ae0038e9820f768423991274680bab994071fd72e22")
def test_0_1(self):
rdata = get_hexdata(self.pemfile, 0, 1)
self.assertEqual(rdata,
"fc2c3033f41412521dfef517f1e25a8139d5793c11a670681acf190b0c615033")
def test_0_2(self):
rdata = get_hexdata(self.pemfile, 0, 2)
self.assertEqual(rdata,
"7aa1f5fb42e714439441058ece39636c1f63ebda9c645d845ea75d1b718d654b1e93a7b65c53ce180f14f3d01cc3068ef9a590aa22df64e0febe64dfbd1b6de2")
def test_1_0(self):
rdata = get_hexdata(self.pemfile, 1, 0)
self.assertEqual(rdata,
"30820122300d06092a864886f70d01010105000382010f003082010a0282010100da64a368e153f415098d80f88d0c451e4f3e82f7829554519ff6d525e19e9f3a2b777a393b21f509ad2700c815c55bef29fdc4b1454bf5bc3a75f9ec4be01af8445fa441adfd0b3bc0eae72242f856ed1a810f95a34b65b6c5cff355e4893eb27f0abb7462d22ec7e291215fc75ba84bfdf60a802a342489a885ebc13b6ffc192993b8ab715b4956bb58d0fe9def81d34114a983749460212a21af1543656b633433ed9611f958bc5b8241a442798d291e9f84b6b0a40a6c71fbb73f16beb749025c2947d986fbf0446385cc1799cfc686a95362caddc3481a3f4085f3a418d3c8d5d38a85681d47a87d870d7cdff2f12d39a1b148e43fb5a3fb37c16d4c880d0203010001")
def test_1_1(self):
rdata = get_hexdata(self.pemfile, 1, 1)
self.assertEqual(rdata,
"ff1628ed04535ce2efb193c42dea08f496b8fbc2629e0bd09f1a3d32fb021be4")
def test_1_2(self):
rdata = get_hexdata(self.pemfile, 1, 2)
self.assertEqual(rdata,
"25fc5c357a28bd84a1308afac3b34038dfe89599af3866263cb10ce1e11675fe10228264ee81efafefeac164b321ff12d9f115a4cc87d0b1369bbb5b51b5a896")
if __name__ == '__main__':
unittest.main()