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)
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)
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)
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)
def test_key_identifier(self): item = KeychainItem.build(self.example_row, path=self.data_path) self.assertEquals("525E210E0B4C49799D7E47DD8E789C78", item.key_identifier)
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)