aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brunschwig <[email protected]>2021-05-02 15:19:37 +0200
committerPatrick Brunschwig <[email protected]>2021-05-02 15:19:37 +0200
commit05d375cd6f86dbc2e0d5e1a583e7f419b712ceba (patch)
tree4f2f739d35d7183e714001398e824d60f86e5453
parent64c555bf4dbed58c72bd92299d1c7c869c686451 (diff)
downloadenigmail-05d375cd6f86dbc2e0d5e1a583e7f419b712ceba.tar.gz
enigmail-05d375cd6f86dbc2e0d5e1a583e7f419b712ceba.tar.bz2
enigmail-05d375cd6f86dbc2e0d5e1a583e7f419b712ceba.zip
fixed test cases, try to get gpgme-json working on Windows
-rw-r--r--.gitlab-ci.yml12
-rw-r--r--package/tests/testHelper.js6
-rw-r--r--ui/content/enigmailMsgComposeOverlay.js2
-rw-r--r--ui/tests/enigmailMsgComposeOverlay-test-a_e.js1
-rw-r--r--ui/tests/enigmailMsgComposeOverlay-test-f_h.js41
5 files changed, 40 insertions, 22 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f2494318..a9f33545 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,9 +46,8 @@ test:
- printf 'user_pref("mail.server.server1.hostname", "Local Folders");\n' >> "$TBPROFILE/prefs.js"
- printf 'user_pref("mail.server.server1.name", "Local Folders");\n' >> "$TBPROFILE/prefs.js"
- printf '{%s "main.js"}\n' '"mainFile":' > "$TBPROFILE/jsunit.json"
- #- export TBDOWNLOAD=$(curl -s 'https://download.mozilla.org/?product=thunderbird-beta-latest&os=linux64&lang=en-US' | sed -E 's/(.*href=")([^"]+)(".*)/\2/')
- export LIBGPGERR=1.42
- - curl -s -o libgpg-error.tar.bz2 https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.42.tar.bz2
+ - curl -s -o libgpg-error.tar.bz2 https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-${LIBGPGERR}.tar.bz2
- tar jxf libgpg-error.tar.bz2
- (cd libgpg-error-${LIBGPGERR} && ./configure && make && make install)
- export GPGMEVERSION=1.15.1
@@ -82,14 +81,11 @@ postbox_test:
- dpkg --add-architecture i386
- apt update -y -qq
- apt install thunderbird wine wine32 perl p7zip-full zip unzip curl xvfb libgtk-3-0 -y -qq
- - export POSTBOXDL=https://enigmail.net/unit-testing/Postbox-7.0.15.zip
- - curl -s -o postbox.zip $POSTBOXDL
+ - curl -s -o postbox.zip https://enigmail.net/unit-testing/Postbox-7.0.15.zip
- unzip postbox.zip
- - export PERLDL=https://enigmail.net/unit-testing/MiniPerl-5.30.zip
- - curl -o perl.zip $PERLDL
+ - curl -o perl.zip https://enigmail.net/unit-testing/MiniPerl-5.30.zip
- unzip perl.zip
- - export GPGDL=https://enigmail.net/unit-testing/gnupg-portable-win32-2.2.17-3.7z
- - curl -o gnupg-inst.7z $GPGDL
+ - curl -o gnupg-inst.7z https://enigmail.net/unit-testing/gnupg-portable-win32-2.2.27-10.7z
- 7z x -y gnupg-inst.7z
- provisioning/wine-setup.sh
diff --git a/package/tests/testHelper.js b/package/tests/testHelper.js
index c03cba9a..82a7e0e8 100644
--- a/package/tests/testHelper.js
+++ b/package/tests/testHelper.js
@@ -190,7 +190,11 @@ function asyncTest(f) {
f(...args).then(x => {
inspector.exitNestedEventLoop(0);
}).catch(x => {
- Assert.ok(false, "Runtime exception: " + x);
+ if ((typeof x === "object") && "stack" in x) {
+ Assert.ok(false, "Runtime error: " + x + "\n" + x.stack);
+ }
+ else
+ Assert.ok(false, "Runtime exception: " + x);
inspector.exitNestedEventLoop(0);
});
inspector.enterNestedEventLoop(0);
diff --git a/ui/content/enigmailMsgComposeOverlay.js b/ui/content/enigmailMsgComposeOverlay.js
index 8a8f9fa0..f280c460 100644
--- a/ui/content/enigmailMsgComposeOverlay.js
+++ b/ui/content/enigmailMsgComposeOverlay.js
@@ -4524,7 +4524,7 @@ Enigmail.msg = {
this.searchKeysTimeout = EnigmailTimer.setTimeout(function _f() {
self.searchKeysTimeout = null;
- Enigmail.msg.findMissingKeys();
+ return Enigmail.msg.findMissingKeys();
},
5000); // 5 Seconds
}
diff --git a/ui/tests/enigmailMsgComposeOverlay-test-a_e.js b/ui/tests/enigmailMsgComposeOverlay-test-a_e.js
index bb044416..65b6b57e 100644
--- a/ui/tests/enigmailMsgComposeOverlay-test-a_e.js
+++ b/ui/tests/enigmailMsgComposeOverlay-test-a_e.js
@@ -290,6 +290,7 @@ function checkProtectHeaders_test() {
Assert.equal(ret, true);
Assert.equal(Enigmail.msg.protectHeaders, false);
+ EnigmailPrefs.setPref = function() {}
}
function compileFromAndTo_test() {
diff --git a/ui/tests/enigmailMsgComposeOverlay-test-f_h.js b/ui/tests/enigmailMsgComposeOverlay-test-f_h.js
index bc09205e..a4ac51c3 100644
--- a/ui/tests/enigmailMsgComposeOverlay-test-f_h.js
+++ b/ui/tests/enigmailMsgComposeOverlay-test-f_h.js
@@ -32,7 +32,21 @@ var EnigmailPrefs = {
getPref: (prop) => {
return 1;
},
- setPref: function() {}
+ setPref: function() {},
+ getPrefRoot: function() {
+ return {
+ getPrefType: function() {
+ return true;
+ },
+ getBoolPref: function(str) {
+ return true;
+ },
+ getCharPref: function(str) {
+ return "";
+ },
+ PREF_BOOL: true
+ };
+ }
};
var EnigmailTimer = {
@@ -79,12 +93,9 @@ function fireSearchKeys_test() {
};
EnigmailTimer.setTimeout = function(callback, time) {
- Assert.ok(true);
Assert.equal(time, 5000);
- callback().then(r => {
- Assert.equal(Enigmail.msg.searchKeysTimeout, null);
- resolve(true);
- });
+ callback();
+ resolve(true);
return false;
};
@@ -104,10 +115,9 @@ function fireSendFlags_test() {
};
EnigmailTimer.setTimeout = function(callback, time) {
- callback().then(r => {
- Assert.ok(true);
- resolve(true);
- });
+ callback();
+ Assert.ok(true);
+ resolve(true);
return null;
};
@@ -130,7 +140,14 @@ function fixMessageSubject_test() {
};
};
+ let h = Enigmail.msg.getMsgHdr;
+ Enigmail.msg.getMsgHdr = function() {
+ return {
+ flags: Ci.nsMsgMessageFlags.HasRe
+ };
+ };
Enigmail.msg.fixMessageSubject();
+ Enigmail.msg.getMsgHdr = h;
}
function focusChange_test() {
@@ -386,6 +403,7 @@ function getForceRecipientDlg_test() {
}
function getMailPref_test() {
+ let h = EnigmailPrefs.getPrefRoot;
EnigmailPrefs.getPrefRoot = function() {
return {
getPrefType: function() {
@@ -422,7 +440,6 @@ function getMailPref_test() {
return true;
},
getCharPref: function(str) {
- Assert.ok(true);
Assert.equal(str, 'xyz');
},
PREF_STRING: 'str'
@@ -430,7 +447,7 @@ function getMailPref_test() {
};
Enigmail.msg.getMailPref('xyz');
-
+ EnigmailPrefs.getPrefRoot = h;
}
function getMsgHdr_test() {