Пример #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")
Пример #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")
Пример #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")
Пример #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")
Пример #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)
Пример #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")
Пример #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, "*****@*****.**")
Пример #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)
Пример #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)
Пример #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)
Пример #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")
Пример #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, "*****@*****.**")
Пример #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)