示例#1
0
 def testSmallPasswordSetInSinglePart(self):
     wrapped_kr = self.MockKeyring()
     kr = multi.MultipartKeyringWrapper(wrapped_kr)
     kr.set_password('s1', 'u1', 'p1')
     self.assertEquals(wrapped_kr.passwords, {'s1u1': 'p1'})
     # should be able to read it back
     self.assertEquals(kr.get_password('s1', 'u1'), 'p1')
示例#2
0
    def testLargePasswordSetInMultipleParts(self):
        wrapped_kr = self.MockKeyring()
        kr = multi.MultipartKeyringWrapper(wrapped_kr,
            max_password_size=2)
        kr.set_password('s2', 'u2', '0123456')
        self.assertEquals(wrapped_kr.passwords, {'s2u2':'01',
                                                 's2u2{{part_1}}':'23',
                                                 's2u2{{part_2}}':'45',
                                                 "s2u2{{part_3}}":'6'})

        # should be able to read it back
        self.assertEquals(kr.get_password('s2', 'u2'), '0123456')
示例#3
0
 def testMissingPassword(self):
     wrapped_kr = self.MockKeyring()
     kr = multi.MultipartKeyringWrapper(wrapped_kr)
     self.assertIsNone(kr.get_password('s1', 'u1'))
示例#4
0
 def testViablePassThru(self):
     kr = multi.MultipartKeyringWrapper(self.MockKeyring())
     self.assertTrue(kr.viable)