aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brunschwig <[email protected]>2021-05-04 08:09:36 +0200
committerPatrick Brunschwig <[email protected]>2021-05-04 08:09:36 +0200
commitaa4f5de76398c08378454d2f674e6765c2240c79 (patch)
treeb9851088f9e48fcb69cd9ba5041e3bbd06e9f11b
parent593a3b54c319116733a4993c0445f73fbbea9cd4 (diff)
downloadenigmail-aa4f5de76398c08378454d2f674e6765c2240c79.tar.gz
enigmail-aa4f5de76398c08378454d2f674e6765c2240c79.tar.bz2
enigmail-aa4f5de76398c08378454d2f674e6765c2240c79.zip
added testcase for getGroups
-rw-r--r--package/cryptoAPI/gpgme.js1
-rw-r--r--package/tests/gpgme-test.js39
2 files changed, 39 insertions, 1 deletions
diff --git a/package/cryptoAPI/gpgme.js b/package/cryptoAPI/gpgme.js
index bde13e1a..45aac387 100644
--- a/package/cryptoAPI/gpgme.js
+++ b/package/cryptoAPI/gpgme.js
@@ -184,6 +184,7 @@ class GpgMECryptoAPI extends CryptoAPI {
for (let g of groups) {
let parts = g.string.match(/^([^=]+)=(.+)$/);
if (parts && parts.length > 2) {
+ parts[1] = parts[1].toLowerCase();
if (parts[1] in groupList) {
groupList[parts[1]] += ` ${parts[2]}`;
}
diff --git a/package/tests/gpgme-test.js b/package/tests/gpgme-test.js
index 1a4a49f3..1150a523 100644
--- a/package/tests/gpgme-test.js
+++ b/package/tests/gpgme-test.js
@@ -1,5 +1,5 @@
/*global do_load_module: false, do_get_file: false, do_get_cwd: false, testing: false, test: false, Assert: false, resetting: false */
-/*global do_test_pending: false, do_test_finished: false, withTestGpgHome: false, asyncTest: false, withEnigmail: false */
+/*global do_test_pending: false, do_test_finished: false, withTestGpgHome: false, asyncTest: false, withEnigmail: false, withOverwriteFuncs: false */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -14,6 +14,43 @@ do_load_module("file://" + do_get_cwd().path + "/testHelper.js");
testing("cryptoAPI/gpgme.js"); /*global getGpgMEApi: false */
+
+test(
+ function testGroups() {
+ const cApi = getGpgMEApi();
+
+ cApi.execJsonCmd = async function(input) {
+ Assert.equal(input.op, "config_opt");
+ Assert.equal(input.component, "gpg");
+ Assert.equal(input.option, "group");
+
+ return {
+ "option": {
+ "name": "group",
+ "description": "set up email aliases",
+ "argname": "SPEC",
+ "flags": 4,
+ "level": 1,
+ "type": 37,
+ "alt_type": 1,
+ "value": [{
+ "is_none": false
+ }, {
+ "string": "[email protected]",
+ "is_none": false
+ }, {
+ "string": "[email protected]",
+ "is_none": false
+ }]
+ }
+ };
+ };
+
+ let res = cApi.getGroups();
+ Assert.equal(res.length, 2);
+ });
+
test(withTestGpgHome(withEnigmail(asyncTest(async (esvc, window) => {
// Test key importing and key listing
const cApi = getGpgMEApi();