Changeset 854
- Timestamp:
- 02/11/09 21:57:13 (10 months ago)
- Location:
- trunk/DJabberd
- Files:
-
- 4 modified
-
Makefile.PL (modified) (1 diff)
-
t/features-hook.t (modified) (2 diffs)
-
t/lib/djabberd-test.pl (modified) (3 diffs)
-
t/sasl-login.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DJabberd/Makefile.PL
r837 r854 15 15 'Log::Log4perl' => 0, 16 16 'Digest::HMAC_SHA1' => 0, 17 'Authen::SASL' => 2.1318 17 }, 19 18 clean => { FILES => 't/log/*' }, -
trunk/DJabberd/t/features-hook.t
r841 r854 5 5 require 'djabberd-test.pl'; 6 6 7 my $HAS_SASL; 8 eval "use Authen::SASL 2.13"; 9 $HAS_SASL = 1 unless $@; 7 10 8 11 sub connect_and_get_features{ … … 54 57 $server->kill; 55 58 56 $server = Test::DJabberd::Server->new(id => 1); 57 $server->start( ); # by default we have SASL plugin enabled 58 my $client = Test::DJabberd::Client->new(server => $server, name => "client"); 59 { 60 my $features = connect_and_get_features($client); 59 SKIP: { 60 skip "These tests require SASL", 8 unless $HAS_SASL; 61 $server = Test::DJabberd::Server->new(id => 1); 62 $server->start( ); # by default we have SASL plugin enabled 63 my $client = Test::DJabberd::Client->new(server => $server, name => "client"); 64 { 65 my $features = connect_and_get_features($client); 61 66 62 like($features, qr{^<features xmlns='http://etherx.jabber.org/streams'>.*</features>$});63 like($features, qr{<auth xmlns='http://jabber.org/features/iq-auth'/>});64 like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>});65 like($features, qr{<optional/>}, "our test setup makes sasl optional, bc of history of djabberd");66 for my $mech (qw/PLAIN DIGEST-MD5 LOGIN/) {67 like($features, qr{<mechanism>$mech</mechanism>}, "supports $mech");68 }67 like($features, qr{^<features xmlns='http://etherx.jabber.org/streams'>.*</features>$}); 68 like($features, qr{<auth xmlns='http://jabber.org/features/iq-auth'/>}); 69 like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 70 like($features, qr{<optional/>}, "our test setup makes sasl optional, bc of history of djabberd"); 71 for my $mech (qw/PLAIN DIGEST-MD5 LOGIN/) { 72 like($features, qr{<mechanism>$mech</mechanism>}, "supports $mech"); 73 } 69 74 70 like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 71 } 72 $server->kill; 75 like($features, qr{<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>.*</mechanisms>}); 76 } 77 $server->kill; 78 }; 73 79 } 74 80 -
trunk/DJabberd/t/lib/djabberd-test.pl
r853 r854 11 11 use DJabberd::RosterStorage::InMemoryOnly; 12 12 use DJabberd::Util; 13 use DJabberd::SASL::AuthenSASL;14 13 use IO::Socket::UNIX; 14 15 my $HAS_SASL; 16 eval "use Authen::SASL 2.13"; 17 unless ($@) { 18 require DJabberd::SASL::AuthenSASL; 19 $HAS_SASL = 1; 20 } 15 21 16 22 sub once_logged_in { … … 250 256 sub standard_plugins { 251 257 my $self = shift; 258 my @sasl; 259 @sasl = ( DJabberd::SASL::AuthenSASL->new( 260 mechanisms => "LOGIN PLAIN DIGEST-MD5", 261 optional => "yes", 262 )) if $HAS_SASL; 252 263 return [ 253 264 DJabberd::Authen::AllowedUsers->new(policy => "deny", … … 258 269 DJabberd::Delivery::Local->new, 259 270 DJabberd::Delivery::S2S->new, 260 DJabberd::SASL::AuthenSASL->new( 261 mechanisms => "LOGIN PLAIN DIGEST-MD5", 262 optional => "yes", 263 ), 271 @sasl 264 272 ]; 265 273 } -
trunk/DJabberd/t/sasl-login.t
r851 r854 2 2 use strict; 3 3 use warnings; 4 use Test::More tests => 46;4 use Test::More; 5 5 use lib 't/lib'; 6 6 7 7 require 'djabberd-test.pl'; 8 8 9 use Authen::SASL 'Perl'; 9 BEGIN { 10 eval "use Authen::SASL 2.13"; 11 if ($@) { 12 plan skip_all => 'Tests require Authen::SASL 2.13+'; 13 } 14 else { 15 plan tests => 46; 16 eval "use Authen::SASL 'Perl';"; 17 } 18 } 10 19 11 20 my $login_and_be = sub {
