X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fmail%2Fgnupg-incoming.t;h=54b30d2a36e5e23a64e3129ad6ad1991c6296009;hb=de9d037528895f7151a9aead6724ce2df95f9586;hp=6ff4f76efbdca6ffbec28a3a4ce1d90e362fdf61;hpb=96783bdc58be6e4f2fc56d516a9ceba57af00ba8;p=freeside.git diff --git a/rt/t/mail/gnupg-incoming.t b/rt/t/mail/gnupg-incoming.t index 6ff4f76ef..54b30d2a3 100644 --- a/rt/t/mail/gnupg-incoming.t +++ b/rt/t/mail/gnupg-incoming.t @@ -1,4 +1,3 @@ -#!/usr/bin/perl use strict; use warnings; @@ -11,7 +10,7 @@ BEGIN { } use RT::Test::GnuPG - tests => 49, + tests => 53, actual_server => 1, gnupg_options => { passphrase => 'rt-test', @@ -29,7 +28,7 @@ ok( $m->login, 'we did log in' ); $m->get( $baseurl.'/Admin/Queues/'); $m->follow_link_ok( {text => 'General'} ); $m->submit_form( form_number => 3, - fields => { CorrespondAddress => 'general@example.com' } ); + fields => { CorrespondAddress => 'general@example.com' } ); $m->content_like(qr/general\@example.com.* - never/, 'has key info.'); ok(my $user = RT::User->new(RT->SystemUser)); @@ -74,6 +73,7 @@ run3( '--default-key' => 'recipient@example.com', '--homedir' => $homedir, '--passphrase' => 'recipient', + '--no-permission-warning', ), \"fnord\r\n", \$buf, @@ -116,6 +116,7 @@ run3( '--default-key' => 'recipient@example.com', '--homedir' => $homedir, '--passphrase' => 'recipient', + '--no-permission-warning', ), \"clearfnord\r\n", \$buf, @@ -158,6 +159,7 @@ run3( '--default-key' => 'recipient@example.com', '--homedir' => $homedir, '--passphrase' => 'recipient', + '--no-permission-warning', ), \"orzzzzzz\r\n", \$buf, @@ -188,7 +190,7 @@ RT::Test->close_mailgate_ok($mail); 'recorded incoming mail that is encrypted' ); is( $msg->GetHeader('X-RT-Privacy'), - 'PGP', + 'GnuPG', 'recorded incoming mail that is encrypted' ); like( $attach->Content, qr/orz/); @@ -225,7 +227,7 @@ RT::Test->close_mailgate_ok($mail); 'recorded incoming mail that is encrypted' ); is( $msg->GetHeader('X-RT-Privacy'), - 'PGP', + 'GnuPG', 'recorded incoming mail that is encrypted' ); like( $attach->Content, qr/orz/); @@ -234,7 +236,6 @@ RT::Test->close_mailgate_ok($mail); ok(index($orig->Content, $buf) != -1, 'found original msg'); } - # test for signed mail by other key $buf = ''; @@ -244,6 +245,7 @@ run3( '--default-key' => 'rt@example.com', '--homedir' => $homedir, '--passphrase' => 'test', + '--no-permission-warning', ), \"alright\r\n", \$buf, @@ -279,6 +281,7 @@ run3( qw(gpg --batch --no-tty --armor --encrypt), '--recipient' => 'random@localhost', '--homedir' => $homedir, + '--no-permission-warning', ), \"should not be there either\r\n", \$buf, @@ -316,6 +319,7 @@ run3( qw(gpg --batch --no-tty --armor --encrypt), '--recipient' => 'rt@example.com', '--homedir' => $homedir, + '--no-permission-warning', ), \"really should not be there either\r\n", \$buf, @@ -346,3 +350,31 @@ is(@mail, 1, 'caught outgoing mail.'); unlike( ($attach ? $attach->Content : ''), qr/really should not be there either/); } + +# test that if it gets base64 transfer-encoded long mail then it doesn't hang +{ + local $SIG{ALRM} = sub { + ok 0, "timed out, web server is probably in deadlock"; + exit; + }; + alarm 30; + $buf = encode_base64('a'x(250*1024)); + $mail = RT::Test->open_mailgate_ok($baseurl); + print $mail <<"EOF"; +From: recipient\@example.com +To: general\@$RT::rtname +Content-transfer-encoding: base64 +Subject: Long not encrypted message for queue + +$buf +EOF + RT::Test->close_mailgate_ok($mail); + alarm 0; + + my $tick = RT::Test->last_ticket; + is( $tick->Subject, 'Long not encrypted message for queue', + "Created the ticket" + ); + my $content = $tick->Transactions->First->Content; + like $content, qr/a{1024,}/, 'content is not lost'; +}