From fa970fa1023ff2b40bd9df7127fe5f1291aad509 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Fri, 2 Aug 2019 16:14:17 +0200 Subject: [PATCH] Test CryptMessage plugin using testAction function --- plugins/CryptMessage/Test/TestCrypt.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/CryptMessage/Test/TestCrypt.py b/plugins/CryptMessage/Test/TestCrypt.py index 681c4790..05cc6e44 100644 --- a/plugins/CryptMessage/Test/TestCrypt.py +++ b/plugins/CryptMessage/Test/TestCrypt.py @@ -47,26 +47,25 @@ class TestCrypt: assert pub1 != pub2 def testEcies(self, ui_websocket): - ui_websocket.actionUserPublickey(0, 0) - pub = ui_websocket.ws.getResult() + pub = ui_websocket.testAction("UserPublickey") - ui_websocket.actionEciesEncrypt(0, "hello", pub) - encrypted = ui_websocket.ws.getResult() + encrypted = ui_websocket.testAction("EciesEncrypt", "hello", pub) assert len(encrypted) == 180 # Don't allow decrypt using other privatekey index - ui_websocket.actionEciesDecrypt(0, encrypted, 123) - decrypted = ui_websocket.ws.getResult() + decrypted = ui_websocket.testAction("EciesDecrypt", encrypted, 123) assert decrypted != "hello" # Decrypt using correct privatekey - ui_websocket.actionEciesDecrypt(0, encrypted) - decrypted = ui_websocket.ws.getResult() + decrypted = ui_websocket.testAction("EciesDecrypt", encrypted) assert decrypted == "hello" + # Decrypt incorrect text + decrypted = ui_websocket.testAction("EciesDecrypt", "baad") + assert decrypted == None + # Decrypt batch - ui_websocket.actionEciesDecrypt(0, [encrypted, "baad", encrypted]) - decrypted = ui_websocket.ws.getResult() + decrypted = ui_websocket.testAction("EciesDecrypt", [encrypted, "baad", encrypted]) assert decrypted == ["hello", None, "hello"] def testEciesUtf8(self, ui_websocket):