예제 #1
0
 def test_security_level(self):
     item = KeychainItem.build(
         ["A37F72DAE965416EA920D2E4A1D7B256", "webforms.WebForm", "atof",
             "example.com", 12345, "", 0, "N"],
         path=self.data_path,
     )
     self.assertEquals("SL5", item.security_level)
예제 #2
0
 def test_security_level(self):
     item = KeychainItem.build(
         [
             "A37F72DAE965416EA920D2E4A1D7B256", "webforms.WebForm", "atof",
             "example.com", 12345, "", 0, "N"
         ],
         path=self.data_path,
     )
     self.assertEquals("SL5", item.security_level)
예제 #3
0
    def test_decrypt(self):
        mock_key = Mock()
        mock_key.decrypt.return_value = """{"fields":[
            {"name":"Username","value":"user","designation":"username"},
            {"value":"abcdef","name":"Password","designation":"password"}
        ]}"""
        item = KeychainItem.build(self.example_row, path=self.data_path)

        self.assertIsNone(item.password)
        item.decrypt_with(mock_key)
        self.assertEquals("abcdef", item.password)
예제 #4
0
    def test_decrypt(self):
        mock_key = Mock()
        mock_key.decrypt.return_value = """{"fields":[
            {"name":"Username","value":"user","designation":"username"},
            {"value":"abcdef","name":"Password","designation":"password"}
        ]}"""
        mock_keychain = Mock()
        mock_keychain.key.return_value = mock_key
        item = KeychainItem.build(self.example_row, path=self.data_path)

        self.assertIsNone(item.password)
        item.decrypt_with(mock_keychain)
        self.assertEquals("abcdef", item.password)
예제 #5
0
 def test_key_identifier(self):
     item = KeychainItem.build(self.example_row, path=self.data_path)
     self.assertEquals("525E210E0B4C49799D7E47DD8E789C78",
                       item.key_identifier)
예제 #6
0
 def test_initialisation_with_contents_data(self):
     item = KeychainItem.build(self.example_row, path=self.data_path)
     self.assertEquals("onetosix", item.name)
     self.assertEquals("CEA5EA6531FC4BE9B7D7F89B5BB18B66", item.identifier)
예제 #7
0
 def test_key_identifier(self):
     item = KeychainItem.build(self.example_row, path=self.data_path)
     self.assertEquals("525E210E0B4C49799D7E47DD8E789C78", item.key_identifier)
예제 #8
0
 def test_initialisation_with_contents_data(self):
     item = KeychainItem.build(self.example_row, path=self.data_path)
     self.assertEquals("onetosix", item.name)
     self.assertEquals("CEA5EA6531FC4BE9B7D7F89B5BB18B66", item.identifier)