diff mail_pop3.t @ 1146:2634d0ef48d3

Tests: mail capability tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 06 Mar 2017 19:28:04 +0300
parents 6c2538ad642d
children 57673c7257a3
line wrap: on
line diff
--- a/mail_pop3.t
+++ b/mail_pop3.t
@@ -92,7 +92,7 @@ http {
 EOF
 
 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon);
-$t->try_run('no auth external')->plan(18);
+$t->try_run('no auth external')->plan(20);
 
 $t->waitforsocket('127.0.0.1:' . port(8111));
 
@@ -120,6 +120,21 @@ my $s = Test::Nginx::POP3->new();
 $s->send('APOP test@example.com ' . ('0' x 32));
 $s->ok('apop');
 
+# auth capabilities
+
+$s = Test::Nginx::POP3->new();
+$s->read();
+
+$s->send('AUTH');
+$s->ok('auth');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.11.11');
+
+is(get_auth_caps($s), 'PLAIN:LOGIN:CRAM-MD5:EXTERNAL', 'auth capabilities');
+
+}
+
 # auth plain
 
 $s = Test::Nginx::POP3->new();
@@ -187,3 +202,15 @@ my $s = Test::Nginx::POP3->new();
 $s->ok('auth external with username');
 
 ###############################################################################
+
+sub get_auth_caps {
+	my ($s) = @_;
+	my @meth;
+
+	while ($s->read() !~ qr/^\./) {
+		push @meth, $1 if /(.*?)\x0d\x0a?/ms;
+	}
+	join ':', @meth;
+}
+
+###############################################################################