From 759a89fcfdbc4b3e5dde36a437ea27a1b0c60775 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 16 Aug 2013 11:41:55 +0200 Subject: [PATCH] Added test for SMTP connection error. --- tests/net/smtp/SMTPTransportTest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/net/smtp/SMTPTransportTest.cpp b/tests/net/smtp/SMTPTransportTest.cpp index 70aaa4fd..4fc899dd 100644 --- a/tests/net/smtp/SMTPTransportTest.cpp +++ b/tests/net/smtp/SMTPTransportTest.cpp @@ -32,6 +32,7 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) VMIME_TEST_LIST_BEGIN + VMIME_TEST(testConnectToInvalidServer) VMIME_TEST(testGreetingError) VMIME_TEST(testMAILandRCPT) VMIME_TEST(testChunking) @@ -40,6 +41,17 @@ VMIME_TEST_SUITE_BEGIN(SMTPTransportTest) VMIME_TEST_LIST_END + void testConnectToInvalidServer() + { + vmime::ref sess + = vmime::create (); + + vmime::utility::url url("smtp://invalid-smtp-server"); + vmime::ref store = sess->getTransport(url); + + VASSERT_THROW("connect", store->connect(), vmime::exceptions::connection_error); + } + void testGreetingError() { vmime::ref session =