[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-240-g784b03f
Ruslan Zakirov
ruz at bestpractical.com
Mon Oct 5 08:37:46 EDT 2009
The branch, 3.8-trunk has been updated
via 784b03f1934f461b2cbe4ae09a5fb1699000376d (commit)
via 3522e51e10dd14a1ef7c05a14390d5852186b659 (commit)
via 2edd81bfe0e6d63c8e372db60e9a01d196888690 (commit)
via a2849bfeaeca60dc516f5a834e25b2b8517ce0e0 (commit)
via f44a6d95ed3a94cb7554d9032d2230ed188bbe2e (commit)
via b8f64fc78c7ea5ee3a6a944dc7ebe5203a65f4d4 (commit)
via e72cff054ef2d0e902532765f3283f5ee762d020 (commit)
from 3f0b78ef165dcbae5e2b6a32be0d088968cd11ae (commit)
Summary of changes:
lib/RT/Interface/Web/QueryBuilder/Tree.pm | 1 +
lib/RT/Test.pm | 92 ++++++++++++++---------------
share/html/Elements/Footer | 1 -
t/mail/gateway.t | 32 ++++------
t/mail/gnupg-incoming.t | 25 +++-----
t/web/ticket-create-utf8.t | 31 +++++++++-
6 files changed, 96 insertions(+), 86 deletions(-)
- Log -----------------------------------------------------------------
commit e72cff054ef2d0e902532765f3283f5ee762d020
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Oct 2 12:36:46 2009 +0400
rearrange RT::Test a little
we had find_executable that duplicates find_bin
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index e5e5e1b..8070b2e 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -693,7 +693,10 @@ sub file_content {
Test::More::diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
open my $fh, "<:raw", $path
- or do { warn "couldn't open file '$path': $!" unless $args{noexist}; return '' };
+ or do {
+ warn "couldn't open file '$path': $!" unless $args{noexist};
+ return ''
+ };
my $content = do { local $/; <$fh> };
close $fh;
@@ -708,7 +711,9 @@ sub find_executable {
require File::Spec;
foreach my $dir ( split /:/, $ENV{'PATH'} ) {
- my $fpath = File::Spec->catpath( (File::Spec->splitpath( $dir, 'no file' ))[0..1], $name );
+ my $fpath = File::Spec->catpath(
+ (File::Spec->splitpath( $dir, 'no file' ))[0..1], $name
+ );
next unless -e $fpath && -r _ && -x _;
return $fpath;
}
@@ -1008,7 +1013,8 @@ sub apache_server_info {
my $self = shift;
my %res = @_;
- my $bin = $res{'executable'} = $ENV{'RT_TEST_APACHE'} || $self->find_apache_server
+ my $bin = $res{'executable'} = $ENV{'RT_TEST_APACHE'}
+ || $self->find_apache_server
|| Test::More::BAIL_OUT("Couldn't find apache server, use RT_TEST_APACHE");
Test::More::diag("Using '$bin' apache executable for testing")
@@ -1075,7 +1081,7 @@ sub apache_fastcgi_server_options {
sub find_apache_server {
my $self = shift;
return $_ foreach grep defined,
- map $self->find_bin($_),
+ map $self->find_executable($_),
qw(httpd apache apache2 apache1);
return undef;
}
@@ -1092,17 +1098,6 @@ sub stop_server {
}
}
-sub find_bin {
- my $self = shift;
- my $name = shift;
-
- return $_ foreach
- grep -e $_ && -x $_,
- map File::Spec->catfile($_, $name),
- split /:/, $ENV{'PATH'};
- return undef;
-}
-
sub fork_exec {
my $self = shift;
@@ -1121,14 +1116,8 @@ sub process_in_file {
my $self = shift;
my %args = ( in => undef, options => undef, @_ );
- my $in_fn = $args{'in'};
- my $text = do {
- open my $fh, '<', $in_fn
- or die "Couldn't open '$in_fn': $!";
- local $/;
- <$fh>
- };
- while ( my ($opt) = ($text =~ /\%\%((?:(?!\%\%).)*)\%\%/) ) {
+ my $text = $self->file_content( $args{'in'} );
+ while ( my ($opt) = ($text =~ /\%\%((?:.+?)\%\%/) ) {
my $value = $args{'options'}{ lc $opt };
die "no value for $opt" unless defined $value;
commit b8f64fc78c7ea5ee3a6a944dc7ebe5203a65f4d4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 12:10:26 2009 +0400
fix small memory leak in the Query Builder
diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 92a79ac..574ead4 100755
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -51,6 +51,7 @@ package RT::Interface::Web::QueryBuilder::Tree;
use strict;
use warnings;
+use Tree::Simple qw/use_weak_refs/;
use base qw/Tree::Simple/;
=head1 NAME
commit f44a6d95ed3a94cb7554d9032d2230ed188bbe2e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 12:12:18 2009 +0400
last_ticket in RT::Test
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 8070b2e..52deda1 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -511,6 +511,15 @@ sub load_or_create_custom_field {
return $obj;
}
+sub last_ticket {
+ my $self = shift;
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
+ $tickets->Limit( FIELD => 'id', OPERATOR => '>', VALUE => '0' );
+ $tickets->RowsPerPage( 1 );
+ return $tickets->First;
+}
+
sub store_rights {
my $self = shift;
commit a2849bfeaeca60dc516f5a834e25b2b8517ce0e0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 12:13:05 2009 +0400
use RT::Test->last_ticket
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index 940bde6..b06daf7 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -70,14 +70,6 @@ use LWP::UserAgent;
my $url = $m->rt_base_url;
-sub latest_ticket {
- my $tickets = RT::Tickets->new( $RT::SystemUser );
- $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
- $tickets->Limit( FIELD => 'id', OPERATOR => '>', VALUE => '0' );
- $tickets->RowsPerPage( 1 );
- return $tickets->First;
-}
-
diag "Make sure that when we call the mailgate without URL, it fails" if $ENV{'TEST_VERBOSE'};
{
my $text = <<EOF;
@@ -133,7 +125,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "Created ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
is ($tick->Id, $id, "correct ticket id");
is ($tick->Subject , 'This is a test of new ticket creation', "Created the ticket");
@@ -153,7 +145,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "Created ticket #$id");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
is ($tick->Id, $id, "correct ticket id");
is ($tick->Subject, 'This is a test of the X-RT-Mail-Extension field', "Created the ticket");
@@ -188,7 +180,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "Created ticket #$id");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
is ($tick->Id, $id, "correct ticket id");
@@ -222,7 +214,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "Created ticket #$id");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
is ($tick->Id, $id, "correct ticket id");
is ($tick->Subject, 'using mailgate without --action arg', "using mailgate without --action arg");
@@ -242,7 +234,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok (!$id, "no ticket created");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ".$tick->Id);
isnt ($tick->Subject , 'This is a test of new ticket creation as an unknown user', "failed to create the new ticket from an unprivileged account");
@@ -276,7 +268,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "ticket created");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ".$tick->Id);
is ($tick->Id, $id, "correct ticket id");
@@ -350,7 +342,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
is ($id, $ticket_id, "replied to the ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ".$tick->Id);
is ($tick->Id, $id, "correct ticket id");
@@ -430,7 +422,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
is ($id, $ticket_id, "added comment to the ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ".$tick->Id);
is ($tick->Id, $id, "correct ticket id");
@@ -475,7 +467,7 @@ diag "Testing preservation of binary attachments" if $ENV{'TEST_VERBOSE'};
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "created ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ".$tick->Id);
is ($tick->Id, $id, "correct ticket id");
@@ -531,7 +523,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "created ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ". $tick->Id);
is ($tick->Id, $id, "correct ticket");
@@ -567,7 +559,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "created ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ". $tick->Id);
is ($tick->Id, $id, "correct ticket");
@@ -597,7 +589,7 @@ EOF
is ($status >> 8, 0, "The mail gateway exited normally");
ok ($id, "created ticket");
- my $tick = latest_ticket();
+ my $tick = RT::Test->last_ticket;
isa_ok ($tick, 'RT::Ticket');
ok ($tick->Id, "found ticket ". $tick->Id);
is ($tick->Id, $id, "correct ticket");
diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index 439ba6a..ec31333 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 46;
+use RT::Test tests => 39;
plan skip_all => 'GnuPG required.'
unless eval 'use GnuPG::Interface; 1';
@@ -61,7 +61,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
is( $tick->Subject,
'This is a test of new ticket creation as root',
"Created the ticket"
@@ -101,7 +101,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
is( $tick->Subject, 'signed message for queue',
"Created the ticket"
);
@@ -143,7 +143,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
is( $tick->Subject, 'signed message for queue',
"Created the ticket"
);
@@ -185,7 +185,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
is( $tick->Subject, 'Encrypted message for queue',
"Created the ticket"
);
@@ -233,7 +233,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
my $txn = $tick->Transactions->First;
my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
# XXX: in this case, which credential should we be using?
@@ -268,7 +268,7 @@ EOF
RT::Test->close_mailgate_ok($mail);
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
my $txn = $tick->Transactions->First;
my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
@@ -312,18 +312,9 @@ is(@mail, 1, 'caught outgoing mail.');
}
{
- my $tick = get_latest_ticket_ok();
+ my $tick = RT::Test->last_ticket;
my $txn = $tick->Transactions->First;
my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
unlike( ($attach ? $attach->Content : ''), qr'really should not be there either');
}
-sub get_latest_ticket_ok {
- my $tickets = RT::Tickets->new($RT::SystemUser);
- $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
- $tickets->Limit( FIELD => 'id', OPERATOR => '>', VALUE => '0' );
- my $tick = $tickets->First();
- ok( $tick->Id, "found ticket " . $tick->Id );
- return $tick;
-}
-
commit 2edd81bfe0e6d63c8e372db60e9a01d196888690
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 12:13:48 2009 +0400
move functions around in RT::Test
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 52deda1..bea6402 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -692,43 +692,6 @@ sub clean_caught_mails {
unlink $mailbox_catcher;
}
-sub file_content {
- my $self = shift;
- my $path = shift;
- my %args = @_;
-
- $path = File::Spec->catfile( @$path ) if ref $path eq 'ARRAY';
-
- Test::More::diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
-
- open my $fh, "<:raw", $path
- or do {
- warn "couldn't open file '$path': $!" unless $args{noexist};
- return ''
- };
- my $content = do { local $/; <$fh> };
- close $fh;
-
- unlink $path if $args{'unlink'};
-
- return $content;
-}
-
-sub find_executable {
- my $self = shift;
- my $name = shift;
-
- require File::Spec;
- foreach my $dir ( split /:/, $ENV{'PATH'} ) {
- my $fpath = File::Spec->catpath(
- (File::Spec->splitpath( $dir, 'no file' ))[0..1], $name
- );
- next unless -e $fpath && -r _ && -x _;
- return $fpath;
- }
- return undef;
-}
-
=head2 get_relocatable_dir
Takes a path relative to the location of the test file that is being
@@ -1107,6 +1070,43 @@ sub stop_server {
}
}
+sub file_content {
+ my $self = shift;
+ my $path = shift;
+ my %args = @_;
+
+ $path = File::Spec->catfile( @$path ) if ref $path eq 'ARRAY';
+
+ Test::More::diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
+
+ open my $fh, "<:raw", $path
+ or do {
+ warn "couldn't open file '$path': $!" unless $args{noexist};
+ return ''
+ };
+ my $content = do { local $/; <$fh> };
+ close $fh;
+
+ unlink $path if $args{'unlink'};
+
+ return $content;
+}
+
+sub find_executable {
+ my $self = shift;
+ my $name = shift;
+
+ require File::Spec;
+ foreach my $dir ( split /:/, $ENV{'PATH'} ) {
+ my $fpath = File::Spec->catpath(
+ (File::Spec->splitpath( $dir, 'no file' ))[0..1], $name
+ );
+ next unless -e $fpath && -r _ && -x _;
+ return $fpath;
+ }
+ return undef;
+}
+
sub fork_exec {
my $self = shift;
commit 3522e51e10dd14a1ef7c05a14390d5852186b659
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 16:27:46 2009 +0400
tests, check that API results match UI
diff --git a/t/web/ticket-create-utf8.t b/t/web/ticket-create-utf8.t
index e343688..a4d7ae9 100644
--- a/t/web/ticket-create-utf8.t
+++ b/t/web/ticket-create-utf8.t
@@ -3,7 +3,9 @@
use strict;
use warnings;
-use RT::Test tests => 8;
+use RT::Test tests => 14;
+
+$RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
use Encode;
@@ -33,6 +35,30 @@ ok $m->login, 'logged in';
qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
'header on the page'
);
+
+ my $ticket = RT::Test->last_ticket;
+ is $ticket->Subject, $ru_test, "correct subject";
+}
+
+# create a ticket with a subject and content
+{
+ ok $m->goto_create_ticket( $q ), "go to create ticket";
+ $m->form_number(3);
+ $m->field( Subject => $ru_test );
+ $m->field( Content => $ru_support );
+ $m->submit;
+
+ $m->content_like(
+ qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
+ 'header on the page'
+ );
+ $m->content_like(
+ qr{\Q$ru_support\E}i,
+ 'content on the page'
+ );
+
+ my $ticket = RT::Test->last_ticket;
+ is $ticket->Subject, $ru_test, "correct subject";
}
# create a ticket with a subject and content
@@ -51,4 +77,7 @@ ok $m->login, 'logged in';
qr{\Q$ru_support\E}i,
'content on the page'
);
+
+ my $ticket = RT::Test->last_ticket;
+ is $ticket->Subject, $ru_test, "correct subject";
}
commit 784b03f1934f461b2cbe4ae09a5fb1699000376d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Mon Oct 5 16:28:46 2009 +0400
there is no point in aborting request at the bottom of Footer
diff --git a/share/html/Elements/Footer b/share/html/Elements/Footer
index bb6c337..2fcdee9 100755
--- a/share/html/Elements/Footer
+++ b/share/html/Elements/Footer
@@ -77,7 +77,6 @@
</body>
</html>
-% $m->abort();
<%ARGS>
$Debug => 0
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list