def test_key_receive(self): gpg_result = {"updated": [{"fingerprint": "08A650B8E2CBC1B02297915DC65626EED13C70DA"}]} with patch("mailpile.commands.GnuPG") as gpg_mock: gpg_mock.return_value.recv_key.return_value = gpg_result res = action(self.mp._session, "crypto/gpg/receivekey", "D13C70DA") self.assertEqual(res.result[0]["updated"][0]["fingerprint"], "08A650B8E2CBC1B02297915DC65626EED13C70DA") gpg_mock.return_value.recv_key.assert_called_with("D13C70DA")
def test_key_search(self): gpg_result = {"D13C70DA": {"uids": [{"email": "*****@*****.**"}]}} with patch('mailpile.plugins.crypto_utils.GnuPG') as gpg_mock: gpg_mock.return_value.search_key.return_value = gpg_result res = action(self.mp._session, "crypto/gpg/searchkey", "D13C70DA") email = res.result["D13C70DA"]["uids"][0]["email"] self.assertEqual(email, "*****@*****.**") gpg_mock.return_value.search_key.assert_called_with("D13C70DA")
def test_key_search(self): gpg_result = {"D13C70DA": {"uids": [{"email": "*****@*****.**"}]}} with patch("mailpile.commands.GnuPG") as gpg_mock: gpg_mock.return_value.search_key.return_value = gpg_result res = action(self.mp._session, "crypto/gpg/searchkey", "D13C70DA") email = res.result["D13C70DA"]["uids"][0]["email"] self.assertEqual(email, "*****@*****.**") gpg_mock.return_value.search_key.assert_called_with("D13C70DA")
def test_key_receive(self): gpg_result = { "updated": [{ "fingerprint": "08A650B8E2CBC1B02297915DC65626EED13C70DA" }] } with patch('mailpile.plugins.crypto_utils.GnuPG') as gpg_mock: gpg_mock.return_value.recv_key.return_value = gpg_result res = action(self.mp._session, "crypto/gpg/receivekey", "D13C70DA") self.assertEqual(res.result[0]["updated"][0]["fingerprint"], "08A650B8E2CBC1B02297915DC65626EED13C70DA") gpg_mock.return_value.recv_key.assert_called_with("D13C70DA")
def test_key_import(self): res = action(self.mp._session, "crypto/gpg/importkey", 'testing/pub.key') self.assertEqual(res.result["results"]["count"] , 1)
def test_key_receive(self): res = action(self.mp._session, "crypto/gpg/receivekey","D13C70DA") self.assertEqual(res.result[0]["updated"][0]["fingerprint"], "08A650B8E2CBC1B02297915DC65626EED13C70DA")
def test_key_search(self): res = action(self.mp._session, "crypto/gpg/searchkey", "D13C70DA") email = res.result["D13C70DA"]["uids"][0]["email"] self.assertEqual(email, "*****@*****.**")
def test_key_import(self): res = action(self.mp._session, "crypto/gpg/importkey", 'testing/pub.key') self.assertEqual(res.result["results"]["count"], 1)
def test_key_import(self): res = action(self.mp._session, "crypto/gpg/importkey", os.path.join('mailpile', 'tests', 'data', 'pub.key')) self.assertEqual(res.result["results"]["count"], 1)
def test_key_import(self): res = action(self.mp._session, "crypto/gpg/importkey", os.path.join("mailpile", "tests", "data", "pub.key")) self.assertEqual(res.result["results"]["count"], 1)