From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- comm/mailnews/imap/test/unit/test_imapClientid.js | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 comm/mailnews/imap/test/unit/test_imapClientid.js (limited to 'comm/mailnews/imap/test/unit/test_imapClientid.js') 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); + } +}); -- cgit v1.2.3