]> granicus.if.org Git - curl/commitdiff
tests: Added imap STATUS command test
authorSteve Holme <steve_holme@hotmail.com>
Mon, 29 Apr 2013 11:43:18 +0000 (12:43 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Mon, 29 Apr 2013 11:53:09 +0000 (12:53 +0100)
tests/data/Makefile.am
tests/data/test809 [new file with mode: 0644]
tests/ftpserver.pl

index 18120374a0487c73bdc60e68574d8b10879ea38d..4de091a4cd0fcf41c565070de114637bce8a52f5 100644 (file)
@@ -64,6 +64,7 @@ test700 test701 test702 test703 test704 test705 test706 test707 test708 \
 test709 test710 test711 test712 \
 \
 test800 test801 test802 test803 test804 test805 test806 test807 test808 \
+test809 \
 \
 test850 test851 test852 test853 test854 test855 test856 test857 \
 \
diff --git a/tests/data/test809 b/tests/data/test809
new file mode 100644 (file)
index 0000000..099dd33
--- /dev/null
@@ -0,0 +1,42 @@
+<testcase>
+<info>
+<keywords>
+IMAP
+STATUS
+CUSTOMREQUEST
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data>
+* STATUS 809 (MESSAGES 231 UIDNEXT 44292)\r
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+imap
+</server>
+ <name>
+IMAP STATUS (CUSTOMREQUEST)
+ </name>
+ <command>
+imap://%HOSTIP:%IMAPPORT -u user:secret -X 'STATUS 809 (UIDNEXT MESSAGES)'
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol>
+A001 CAPABILITY\r
+A002 LOGIN user secret\r
+A003 STATUS 809 (UIDNEXT MESSAGES)\r
+A004 LOGOUT\r
+</protocol>
+</verify>
+</testcase>
index 4c0144ff9de51a41ac8067d8dd6aaf262f83c70c..1163dcb74a2af28d5c23b8ef8d9bfd5f9fff2568 100755 (executable)
@@ -583,6 +583,7 @@ sub protocolsetup {
             'LIST'   => \&LIST_imap,
             'LOGOUT'   => \&LOGOUT_imap,
             'SELECT' => \&SELECT_imap,
+            'STATUS'  => \&STATUS_imap,
             'STORE'  => \&STORE_imap
         );
         %displaytext = (
@@ -1004,6 +1005,32 @@ sub EXAMINE_imap {
     return 0;
 }
 
+sub STATUS_imap {
+    my ($testno) = @_;
+    fix_imap_params($testno);
+
+    logmsg "STATUS_imap got test $testno\n";
+
+    $testno =~ s/^([^0-9]*)//;
+    my $testpart = "";
+    if ($testno > 10000) {
+        $testpart = $testno % 10000;
+        $testno = int($testno / 10000);
+    }
+
+    loadtest("$srcdir/data/test$testno");
+
+    @data = getpart("reply", "data$testpart");
+
+    for my $d (@data) {
+        sendcontrol $d;
+    }
+
+    sendcontrol "$cmdid OK STATUS completed\r\n";
+
+    return 0;
+}
+
 sub LOGOUT_imap {
     sendcontrol "* BYE cURL IMAP server signing off\r\n";
     sendcontrol "$cmdid OK LOGOUT completed\r\n";