示例#1
0
    def test_sanity(self):                    
        """decrypt(encrypt(instr))==instr for all unicode chars"""
        chars = []
        for i in xrange(0, sys.maxint):
            try:
                chars.append(unichr(i))
            except ValueError:
#                print i," not in range"
                break 
        instr = "".join(chars).encode('utf8')
        self.assertEqual(instr, Cipher.decrypt(Cipher.encrypt(instr)))
示例#2
0
 def test_known_values(self):                                   
     """encrypt should give known result with known input"""
     for clear_text, encrypted_text in self.knownValues:              
         result = Cipher.encrypt(clear_text)          
         self.assertEqual(encrypted_text, result)