Ejemplo n.º 1
0
    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")
Ejemplo n.º 2
0
    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")
Ejemplo n.º 3
0
    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")
Ejemplo n.º 4
0
    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")
Ejemplo n.º 5
0
 def test_key_import(self):
     res = action(self.mp._session, "crypto/gpg/importkey", 'testing/pub.key')
     self.assertEqual(res.result["results"]["count"] , 1)
Ejemplo n.º 6
0
 def test_key_receive(self):
     res = action(self.mp._session, "crypto/gpg/receivekey","D13C70DA")
     self.assertEqual(res.result[0]["updated"][0]["fingerprint"],
                      "08A650B8E2CBC1B02297915DC65626EED13C70DA")
Ejemplo n.º 7
0
 def test_key_search(self):
     res = action(self.mp._session, "crypto/gpg/searchkey", "D13C70DA")
     email = res.result["D13C70DA"]["uids"][0]["email"]
     self.assertEqual(email, "*****@*****.**")
Ejemplo n.º 8
0
 def test_key_import(self):
     res = action(self.mp._session, "crypto/gpg/importkey",
                  'testing/pub.key')
     self.assertEqual(res.result["results"]["count"], 1)
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 def test_key_receive(self):
     res = action(self.mp._session, "crypto/gpg/receivekey","D13C70DA")
     self.assertEqual(res.result[0]["updated"][0]["fingerprint"],
                      "08A650B8E2CBC1B02297915DC65626EED13C70DA")
Ejemplo n.º 12
0
 def test_key_search(self):
     res = action(self.mp._session, "crypto/gpg/searchkey", "D13C70DA")
     email = res.result["D13C70DA"]["uids"][0]["email"]
     self.assertEqual(email, "*****@*****.**")
Ejemplo n.º 13
0
 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)