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/compose/test/unit/test_smtpProxy.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/compose/test/unit/test_smtpProxy.js')
-rw-r--r-- | comm/mailnews/compose/test/unit/test_smtpProxy.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/comm/mailnews/compose/test/unit/test_smtpProxy.js b/comm/mailnews/compose/test/unit/test_smtpProxy.js new file mode 100644 index 0000000000..7a008be001 --- /dev/null +++ b/comm/mailnews/compose/test/unit/test_smtpProxy.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +// Tests that SMTP over a SOCKS proxy works. + +const { NetworkTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/NetworkTestUtils.jsm" +); +const { PromiseTestUtils } = ChromeUtils.import( + "resource://testing-common/mailnews/PromiseTestUtils.jsm" +); + +const PORT = 25; +var daemon, localserver, server; + +add_setup(function () { + localAccountUtils.loadLocalMailAccount(); + server = setupServerDaemon(); + daemon = server._daemon; + server.start(); + NetworkTestUtils.configureProxy("smtp.tinderbox.invalid", PORT, server.port); + localserver = getBasicSmtpServer(PORT, "smtp.tinderbox.invalid"); +}); + +add_task(async function sendMessage() { + equal(daemon.post, undefined); + let identity = getSmtpIdentity("test@tinderbox.invalid", localserver); + var testFile = do_get_file("data/message1.eml"); + var urlListener = new PromiseTestUtils.PromiseUrlListener(); + MailServices.smtp.sendMailMessage( + testFile, + "somebody@example.org", + identity, + "me@example.org", + null, + urlListener, + null, + null, + false, + "", + {}, + {} + ); + await urlListener.promise; + notEqual(daemon.post, ""); +}); + +add_task(async function cleanUp() { + NetworkTestUtils.shutdownServers(); +}); |