diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/imap/test/unit/test_imapClientid.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/imap/test/unit/test_imapClientid.js')
-rw-r--r-- | comm/mailnews/imap/test/unit/test_imapClientid.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/comm/mailnews/imap/test/unit/test_imapClientid.js b/comm/mailnews/imap/test/unit/test_imapClientid.js new file mode 100644 index 0000000000..bceb7c05bf --- /dev/null +++ b/comm/mailnews/imap/test/unit/test_imapClientid.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. +http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var { MailServices } = ChromeUtils.import( + "resource:///modules/MailServices.jsm" +); + +var incomingServer, server; + +const kUserName = "user"; +const kValidPassword = "password"; + +var gTests = [ + { + title: "Cleartext password, with server only supporting old-style login", + clientAuthMethod: Ci.nsMsgAuthMethod.passwordCleartext, + serverAuthMethods: [], + expectSuccess: true, + transaction: [ + "capability", + "CLIENTID", + "authenticate PLAIN", + "capability", + "list", + "lsub", + ], + }, +]; + +add_task(async function () { + let daemon = new ImapDaemon(); + server = makeServer(daemon, "", { + // Make username of server match the singons.txt file + // (pw there is intentionally invalid) + kUsername: kUserName, + kPassword: kValidPassword, + }); + server.setDebugLevel(fsDebugAll); + incomingServer = createLocalIMAPServer(server.port); + + // Turn on CLIENTID and populate the clientid with a uuid. + incomingServer.clientidEnabled = true; + incomingServer.clientid = "4d8776ca-0251-11ea-8d71-362b9e155667"; + + // Connect. + incomingServer.performExpand(null); + server.performTest("LSUB"); + + do_check_transaction(server.playTransaction(), gTests[0].transaction, false); + + server.resetTest(); +}); + +registerCleanupFunction(function () { + incomingServer.closeCachedConnections(); + server.stop(); + + var thread = gThreadManager.currentThread; + while (thread.hasPendingEvents()) { + thread.processNextEvent(true); + } +}); |