]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - Crypto/test/test_rfc1751.py
60ec4427b1a309be0d53afaf033a27dff3158926
[tahoe-lafs/tahoe-lafs.git] / Crypto / test / test_rfc1751.py
1 #
2 # Test script for Crypto.Util.randpool.
3 #
4
5 __revision__ = "$Id: test_rfc1751.py,v 1.3 2003/02/28 15:24:01 akuchling Exp $"
6
7 import binascii
8 from sancho.unittest import TestScenario, parse_args, run_scenarios
9 from allmydata.Crypto.Util import RFC1751
10
11 tested_modules = [ "Crypto.Util.RFC1751" ]
12
13 test_data = [('EB33F77EE73D4053', 'TIDE ITCH SLOW REIN RULE MOT'),
14              ('CCAC2AED591056BE4F90FD441C534766',
15               'RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE'),
16              ('EFF81F9BFBC65350920CDD7416DE8009',
17               'TROD MUTE TAIL WARM CHAR KONG HAAG CITY BORE O TEAL AWL')
18              ]
19
20 class RFC1751Test (TestScenario):
21
22     def setup (self):
23         pass
24
25     def shutdown (self):
26         pass
27
28     def check_k2e (self):
29         "Check converting keys to English"
30         for key, words in test_data:
31             key=binascii.a2b_hex(key)
32             self.test_val('RFC1751.key_to_english(key)', words)
33
34     def check_e2k (self):
35         "Check converting English strings to keys"
36         for key, words in test_data:
37             key=binascii.a2b_hex(key)
38             self.test_val('RFC1751.english_to_key(words)', key)
39
40 # class RFC1751Test
41
42
43 if __name__ == "__main__":
44     (scenarios, options) = parse_args()
45     run_scenarios(scenarios, options)