diff options
author | Shane <shane.kearns@accenture.com> | 2012-03-14 13:22:01 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-03 12:45:46 +0200 |
commit | e09fc38a3624f372c9f0b7339b460468961e918b (patch) | |
tree | 466256bc678274890a2f58b9177b25b4a6017294 /tests/auto/network-settings.h | |
parent | aad60ec53683e057c05ff760200a467e844cfba3 (diff) |
Don't require exact IMAP server version in autotests
The string from the server should begin with "* OK" and end
with "\r\n" according to the IMAP specification.
Still have a check for "server ready" as this does not change between
cyrus versions.
Change-Id: Ia01ed8aa054e5726bba8b411d30edc6205cc8465
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/network-settings.h')
-rw-r--r-- | tests/auto/network-settings.h | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h index f2c12bc092..4c36e2d308 100644 --- a/tests/auto/network-settings.h +++ b/tests/auto/network-settings.h @@ -78,24 +78,12 @@ public: static bool compareReplyIMAP(QByteArray const& actual) { - QList<QByteArray> expected; - - // 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; @@ -103,27 +91,7 @@ public: static bool compareReplyIMAPSSL(QByteArray const& actual) { - QList<QByteArray> expected; - - // 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) |