diff options
Diffstat (limited to 'tests/auto/network-settings.h')
-rw-r--r-- | tests/auto/network-settings.h | 71 |
1 files changed, 7 insertions, 64 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index 9038b9a..7612bf4 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -151,37 +151,12 @@ public: static bool compareReplyIMAP(QByteArray const& actual) { - QList<QByteArray> expected; - -#ifdef Q_OS_SYMBIAN - loadTestSettings(); - - if(QtNetworkSettings::entries.contains("imap.expectedreply")) { - QtNetworkSettingsRecord* entry = entries["imap.expectedreply"]; - if(imapExpectedReply.isNull()) { - imapExpectedReply = entry->recordValue().toAscii(); - imapExpectedReply.append('\r').append('\n'); - } - expected << imapExpectedReply.data(); - } -#endif - - // Mandriva; old test server - expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS LOGINDISABLED] " ) - .append(QtNetworkSettings::serverName().toAscii()) - .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - - // Ubuntu 10.04; new test server - expected << QByteArray( "* OK " ) - .append(QtNetworkSettings::serverLocalName().toAscii()) - .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n"); - - // Feel free to add more as needed - - Q_FOREACH (QByteArray const& ba, expected) { - if (ba == actual) { - return true; - } + // Server greeting may contain capability, version and server name + // But spec only requires "* OK" and "\r\n" + // Match against a prefix and postfix that covers all Cyrus versions + if (actual.startsWith("* OK ") + && actual.endsWith("server ready\r\n")) { + return true; } return false; @@ -189,39 +164,7 @@ public: static bool compareReplyIMAPSSL(QByteArray const& actual) { - QList<QByteArray> expected; - -#ifdef Q_OS_SYMBIAN - loadTestSettings(); - - if(QtNetworkSettings::entries.contains("imap.expectedreplyssl")) { - QtNetworkSettingsRecord* entry = entries["imap.expectedreplyssl"]; - if(imapExpectedReplySsl.isNull()) { - imapExpectedReplySsl = entry->recordValue().toAscii(); - imapExpectedReplySsl.append('\r').append('\n'); - } - expected << imapExpectedReplySsl.data(); - } -#endif - // Mandriva; old test server - expected << QByteArray( "* OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN SASL-IR] " ) - .append(QtNetworkSettings::serverName().toAscii()) - .append(" Cyrus IMAP4 v2.3.11-Mandriva-RPM-2.3.11-6mdv2008.1 server ready\r\n"); - - // Ubuntu 10.04; new test server - expected << QByteArray( "* OK " ) - .append(QtNetworkSettings::serverLocalName().toAscii()) - .append(" Cyrus IMAP4 v2.2.13-Debian-2.2.13-19 server ready\r\n"); - - // Feel free to add more as needed - - Q_FOREACH (QByteArray const& ba, expected) { - if (ba == actual) { - return true; - } - } - - return false; + return compareReplyIMAP(actual); } static bool compareReplyFtp(QByteArray const& actual) |