[Rt-commit] r5746 - in rt/branches/3.6-RELEASE: bin
ruz at bestpractical.com
ruz at bestpractical.com
Wed Aug 9 16:32:01 EDT 2006
Author: ruz
Date: Wed Aug 9 16:32:00 2006
New Revision: 5746
Modified:
rt/branches/3.6-RELEASE/bin/rt-mailgate.in
rt/branches/3.6-RELEASE/lib/t/regression/06mailgateway.t
Log:
* mailgate without --action argument were failing
* tests
Modified: rt/branches/3.6-RELEASE/bin/rt-mailgate.in
==============================================================================
--- rt/branches/3.6-RELEASE/bin/rt-mailgate.in (original)
+++ rt/branches/3.6-RELEASE/bin/rt-mailgate.in Wed Aug 9 16:32:00 2006
@@ -52,6 +52,7 @@
use strict;
+use warnings;
use Getopt::Long;
use LWP::UserAgent;
@@ -75,10 +76,11 @@
$ua->cookie_jar( { file => $opts{jar} } );
my %args = (
- queue => $opts{queue},
- action => $opts{action},
- SessionType => 'REST', # Surpress login box
+ SessionType => 'REST', # Surpress login box
);
+foreach ( qw(queue action) ) {
+ $args{$_} = $opts{$_} if defined $opts{$_};
+};
# Read the message in from STDIN
$args{'message'} = do { local (@ARGV, $/); <> };
Modified: rt/branches/3.6-RELEASE/lib/t/regression/06mailgateway.t
==============================================================================
--- rt/branches/3.6-RELEASE/lib/t/regression/06mailgateway.t (original)
+++ rt/branches/3.6-RELEASE/lib/t/regression/06mailgateway.t Wed Aug 9 16:32:00 2006
@@ -52,7 +52,7 @@
=cut
use strict;
-use Test::More tests => 104;
+use Test::More tests => 109;
use RT;
RT::LoadConfig();
@@ -108,6 +108,32 @@
# }}}
+# {{{ Test new ticket creation without --action argument
+
+$! = 0;
+ok(open(MAIL, "|$RT::BinPath/rt-mailgate --debug --url $url --queue general"), "Opened the mailgate - $!");
+print MAIL <<EOF;
+From: root\@localhost
+To: rt\@$RT::rtname
+Subject: using mailgate without --action arg
+
+Blah!
+Foob!
+EOF
+close (MAIL);
+
+#Check the return value
+is ($? >> 8, 0, "The mail gateway exited normally. yay");
+
+$tickets = RT::Tickets->new($RT::SystemUser);
+$tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
+$tickets->Limit(FIELD => 'id', OPERATOR => '>', VALUE => '0');
+$tick = $tickets->First;
+isa_ok ($tick,'RT::Ticket');
+ok ($tick->Id, "found ticket ".$tick->Id);
+is ($tick->Subject, 'using mailgate without --action arg', "using mailgate without --action arg");
+
+# }}}
# {{{This is a test of new ticket creation as an unknown user
More information about the Rt-commit
mailing list