From b56e3d43e5de43121779dfbbe0f7d1a19bef8c7b Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Mon, 29 Apr 2013 12:43:18 +0100 Subject: tests: Added imap STATUS command test --- tests/data/Makefile.am | 1 + tests/data/test809 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/ftpserver.pl | 27 +++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 tests/data/test809 diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 18120374a..4de091a4c 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -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 index 000000000..099dd3322 --- /dev/null +++ b/tests/data/test809 @@ -0,0 +1,42 @@ + + + +IMAP +STATUS +CUSTOMREQUEST + + + +# +# Server-side + + +* STATUS 809 (MESSAGES 231 UIDNEXT 44292) + + + +# +# Client-side + + +imap + + +IMAP STATUS (CUSTOMREQUEST) + + +imap://%HOSTIP:%IMAPPORT -u user:secret -X 'STATUS 809 (UIDNEXT MESSAGES)' + + + +# +# Verify data after the test has been "shot" + + +A001 CAPABILITY +A002 LOGIN user secret +A003 STATUS 809 (UIDNEXT MESSAGES) +A004 LOGOUT + + + diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 4c0144ff9..1163dcb74 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -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"; -- cgit v1.2.3