From 58f7e57896a2b619fea819f247ccb4ed7e870ada Mon Sep 17 00:00:00 2001 From: toby Date: Wed, 15 Mar 2017 12:16:00 -0400 Subject: [PATCH] Add tests for PGP decrypting passwords correctly --- test/tests/operations/PGP.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/tests/operations/PGP.js b/test/tests/operations/PGP.js index 57736d1b..08168b54 100644 --- a/test/tests/operations/PGP.js +++ b/test/tests/operations/PGP.js @@ -197,6 +197,34 @@ var PGP_TEST_KEY_PAIRS = [ }, ]; +PGP_TEST_KEY_PAIRS.forEach(function(keyPair) { + if (keyPair.password) { + TestRegister.addTests( + ["", "nottherightpassword"].map(function(incorrectPW) { + var testName = "PGP Encrypt, PGP Decrypt: ensure error for incorrect password (pw [$pw], $ks, $name)"; + testName = testName.replace("$ks", keyPair.size); + testName = testName.replace("$pw", incorrectPW); + + return { + name: testName, + input: "hello world", + expectedError: true, + recipeConfig: [ + { + op: "PGP Encrypt", + args: [keyPair.pub], + }, + { + op: "PGP Decrypt", + args: [keyPair.sec, incorrectPW], + }, + ], + }; + }) + ); + } +}); + ["", "hello world"].forEach(function(input) { TestRegister.addTests( PGP_TEST_KEY_PAIRS.map(function(keyPair) {