diff options
Diffstat (limited to 'rt/t')
-rw-r--r-- | rt/t/api/tickets_overlay_sql.t | 27 | ||||
-rw-r--r-- | rt/t/mail/charsets-outgoing.t | 9 | ||||
-rw-r--r-- | rt/t/mail/crypt-gnupg.t | 2 | ||||
-rw-r--r-- | rt/t/mail/extractsubjecttag.t | 8 | ||||
-rw-r--r-- | rt/t/mail/gateway.t | 14 | ||||
-rw-r--r-- | rt/t/mail/multipart.t | 96 | ||||
-rw-r--r-- | rt/t/ticket/linking.t | 6 | ||||
-rw-r--r-- | rt/t/ticket/scrips_batch.t | 2 | ||||
-rw-r--r-- | rt/t/web/attachment_encoding.t | 2 | ||||
-rw-r--r-- | rt/t/web/charting.t | 69 | ||||
-rw-r--r-- | rt/t/web/command_line.t | 2 | ||||
-rw-r--r-- | rt/t/web/compilation_errors.t | 2 | ||||
-rw-r--r-- | rt/t/web/path-traversal.t | 40 | ||||
-rw-r--r-- | rt/t/web/private-components.t | 40 | ||||
-rw-r--r-- | rt/t/web/query_builder.t | 29 | ||||
-rw-r--r-- | rt/t/web/richtext-autohandler.t | 13 |
16 files changed, 326 insertions, 35 deletions
diff --git a/rt/t/api/tickets_overlay_sql.t b/rt/t/api/tickets_overlay_sql.t index 798088664..5bc614077 100644 --- a/rt/t/api/tickets_overlay_sql.t +++ b/rt/t/api/tickets_overlay_sql.t @@ -1,7 +1,6 @@ use RT; -use RT::Test tests => 7; - +use RT::Test tests => 19; { @@ -33,6 +32,7 @@ my $string = 'subject/content SQL test'; my $t = RT::Ticket->new($RT::SystemUser); ok( $t->Create( Queue => 'General', + Requestor => 'jesse@example.com', Subject => 'another ticket', MIMEObj => $Message, MemberOf => $created[0] @@ -66,7 +66,30 @@ my $string = 'subject/content SQL test'; is ($count, scalar @created, "number of returned tickets same as entered"); } +diag "Make sure we don't barf on invalid input for IS / IS NOT"; +{ + my ($status, $msg) = $tix->FromSQL("Subject IS 'foobar'"); + ok ($status, "valid query") or diag("error: $msg"); + is $tix->Count, 0, "found no tickets"; + unlike $tix->BuildSelectQuery, qr/foobar/, "didn't find foobar in the select"; + like $tix->BuildSelectQuery, qr/Subject IS NULL/, "found right clause"; + + my ($status, $msg) = $tix->FromSQL("Subject IS NOT 'foobar'"); + ok ($status, "valid query") or diag("error: $msg"); + is $tix->Count, 2, "found two tickets"; + unlike $tix->BuildSelectQuery, qr/foobar/, "didn't find foobar in the select"; + like $tix->BuildSelectQuery, qr/Subject IS NOT NULL/, "found right clause"; +} + +{ + my ($status, $msg) = $tix->FromSQL("Requestor.Signature LIKE 'foo'"); + ok (!$status, "invalid query - Signature not valid") or diag("error: $msg"); + my ($status, $msg) = $tix->FromSQL("Requestor.EmailAddress LIKE 'jesse'"); + ok ($status, "valid query") or diag("error: $msg"); + is $tix->Count, 1, "found one ticket"; + like $tix->First->Subject, qr/another ticket/, "found the right ticket"; +} } diff --git a/rt/t/mail/charsets-outgoing.t b/rt/t/mail/charsets-outgoing.t index e8f78cc1a..e3f13fb6c 100644 --- a/rt/t/mail/charsets-outgoing.t +++ b/rt/t/mail/charsets-outgoing.t @@ -320,12 +320,3 @@ foreach my $set ( 'ru', 'latin1' ) { } } # subject tag set - -sub parse_mail { - my $mail = shift; - require RT::EmailParser; - my $parser = new RT::EmailParser; - $parser->ParseMIMEEntityFromScalar( $mail ); - return $parser->Entity; -} - diff --git a/rt/t/mail/crypt-gnupg.t b/rt/t/mail/crypt-gnupg.t index f33fbab1c..cc52dd631 100644 --- a/rt/t/mail/crypt-gnupg.t +++ b/rt/t/mail/crypt-gnupg.t @@ -285,7 +285,7 @@ diag 'wrong signed/encrypted parts: wrong proto' if $ENV{'TEST_VERBOSE'}; diag 'verify inline and in attachment signatures' if $ENV{'TEST_VERBOSE'}; { - open my $fh, "$homedir/signed_old_style_with_attachment.eml"; + open( my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" ) or die $!; my $parser = new MIME::Parser; my $entity = $parser->parse( $fh ); diff --git a/rt/t/mail/extractsubjecttag.t b/rt/t/mail/extractsubjecttag.t index 5a2548883..fcaba8c98 100644 --- a/rt/t/mail/extractsubjecttag.t +++ b/rt/t/mail/extractsubjecttag.t @@ -88,11 +88,3 @@ EOF unlike($freshticket->Subject,qr/\[\Q$subject_tag\E #$ticketid\]/,'Stripped Queue Subject Tag correctly'); } - -sub parse_mail { - my $mail = shift; - require RT::EmailParser; - my $parser = new RT::EmailParser; - $parser->ParseMIMEEntityFromScalar( $mail ); - return $parser->Entity; -} diff --git a/rt/t/mail/gateway.t b/rt/t/mail/gateway.t index 00de1ec7f..d57b063a2 100644 --- a/rt/t/mail/gateway.t +++ b/rt/t/mail/gateway.t @@ -621,7 +621,7 @@ ok( $id, 'new ticket created' ); is( $tick->Owner, $RT::Nobody->Id, 'owner of the new ticket is nobody' ); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!"); print MAIL <<EOF; From: root\@localhost Subject: [@{[RT->Config->Get('rtname')]} \#$id] test @@ -645,7 +645,7 @@ is( $tick->Owner, $RT::Nobody->Id, 'set owner back to nobody'); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@"); print MAIL <<EOF; From: root\@localhost Subject: [@{[RT->Config->Get('rtname')]} \#$id] correspondence @@ -669,7 +669,7 @@ is( $tick->Transactions->Count, 6, 'no superfluous transactions'); is( $txns->First->Subject, "[$RT::rtname \#$id] correspondence", 'successfuly add correspond within take via email' ); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!"); print MAIL <<EOF; From: root\@localhost Subject: [@{[RT->Config->Get('rtname')]} \#$id] test @@ -703,7 +703,7 @@ ok( $id, 'create new ticket' ); my $rtname = RT->Config->Get('rtname'); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!"); print MAIL <<EOF; From: ext-mailgate\@localhost Subject: [$rtname \#$id] test @@ -721,7 +721,7 @@ my $ace_id = $status; ok( $user->HasRight( Right => 'ReplyToTicket', Object => $tick ), "User can reply to ticket" ); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!"); print MAIL <<EOF; From: ext-mailgate\@localhost Subject: [$rtname \#$id] test @@ -736,7 +736,7 @@ cmp_ok( $tick->Owner, '!=', $user->id, "we didn't change owner" ); is( $tick->Transactions->Count, 3, "one transactions added" ); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!"); print MAIL <<EOF; From: ext-mailgate\@localhost Subject: [$rtname \#$id] test @@ -777,7 +777,7 @@ ok( $status, "successfuly granted right: $msg" ); ok( $status, "successfuly granted right: $msg" ); $! = 0; -ok(open(MAIL, "|$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!"); +ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!"); print MAIL <<EOF; From: ext-mailgate\@localhost Subject: [$rtname \#$id] test diff --git a/rt/t/mail/multipart.t b/rt/t/mail/multipart.t new file mode 100644 index 000000000..dc97b266f --- /dev/null +++ b/rt/t/mail/multipart.t @@ -0,0 +1,96 @@ +#!/usr/bin/perl -w +# BEGIN BPS TAGGED BLOCK {{{ +# +# COPYRIGHT: +# +# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +# <jesse.com> +# +# (Except where explicitly superseded by other copyright notices) +# +# +# LICENSE: +# +# This work is made available to you under the terms of Version 2 of +# the GNU General Public License. A copy of that license should have +# been provided with this software, but in any event can be snarfed +# from www.gnu.org. +# +# This work is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 or visit their web page on the internet at +# http://www.gnu.org/copyleft/gpl.html. +# +# +# CONTRIBUTION SUBMISSION POLICY: +# +# (The following paragraph is not intended to limit the rights granted +# to you to modify and distribute this software under the terms of +# the GNU General Public License and is only of importance to you if +# you choose to contribute your changes and enhancements to the +# community by submitting them to Best Practical Solutions, LLC.) +# +# By intentionally submitting any modifications, corrections or +# derivatives to this work, or any other work intended for use with +# Request Tracker, to Best Practical Solutions, LLC, you confirm that +# you are the copyright holder for those contributions and you grant +# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +# royalty-free, perpetual, license to use, copy, create derivative +# works based on those contributions, and sublicense and distribute +# those contributions and any derivatives thereof. +# +# END BPS TAGGED BLOCK }}} + +=head1 NAME + +rt-mailgate - Mail interface to RT3. + +=cut + +use strict; +use warnings; + +use RT::Test tests => 5; +use RT::Test::Email; +my ($baseurl, $m) = RT::Test->started_ok; + +my $queue = RT::Test->load_or_create_queue( Name => 'General' ); +my $user = RT::Test->load_or_create_user( Name => 'bob', EmailAddress => 'bob@example.com' ); +$queue->AddWatcher( Type => 'AdminCc', PrincipalId => $user->PrincipalObj->Id ); + +my $text = <<EOF; +Subject: Badly handled multipart email +From: root\@localhost +To: rt\@@{[RT->Config->Get('rtname')]} +Content-Type: multipart/alternative; boundary=20cf3071cac0cb9772049eb22371 + +--20cf3071cac0cb9772049eb22371 +Content-Type: text/plain; charset=ISO-8859-1 + +Hi + +--20cf3071cac0cb9772049eb22371 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable + +<div>Hi</div> + +--20cf3071cac0cb9772049eb22371-- +EOF + +my ( $status, $id ) = RT::Test->send_via_mailgate($text); +is( $status >> 8, 0, "The mail gateway exited normally" ); +ok( $id, "Created ticket" ); + +my @msgs = RT::Test->fetch_caught_mails; +is(@msgs,2,"sent 2 emails"); +diag("We're skipping any testing of the autoreply"); + +my $entity = parse_mail($msgs[1]); +is($entity->parts, 0, "only one entity"); diff --git a/rt/t/ticket/linking.t b/rt/t/ticket/linking.t index 2ea3d58da..fc4761d47 100644 --- a/rt/t/ticket/linking.t +++ b/rt/t/ticket/linking.t @@ -38,14 +38,14 @@ my $q2 = RT::Queue->new($RT::SystemUser); ok ($id,$msg); my $commit_code = <<END; -open my \$file, "<$filename" or die "couldn't open $filename"; +open( my \$file, '<', "$filename" ) or die "couldn't open $filename"; my \$data = <\$file>; chomp \$data; \$data += 0; close \$file; \$RT::Logger->debug("Data is \$data"); -open \$file, ">$filename" or die "couldn't open $filename"; +open( \$file, '>', "$filename" ) or die "couldn't open $filename"; if (\$self->TransactionObj->Type eq 'AddLink') { \$RT::Logger->debug("AddLink"); print \$file \$data+1, "\n"; @@ -375,7 +375,7 @@ ok($link->LocalBase == 0, "LocalBase set correctly"); sub link_count { my $file = shift; - open my $fh, "<$file" or die "couldn't open $file"; + open ( my $fh, '<', $file ) or die "couldn't open $file"; my $data = <$fh>; close $fh; diff --git a/rt/t/ticket/scrips_batch.t b/rt/t/ticket/scrips_batch.t index f558d3bd4..f13881b65 100644 --- a/rt/t/ticket/scrips_batch.t +++ b/rt/t/ticket/scrips_batch.t @@ -45,7 +45,7 @@ my $sid; my ($tmp_fh, $tmp_fn) = tempfile(); my $code = <<END; -open my \$fh, '>', '$tmp_fn' or die "Couldn't open '$tmp_fn':\$!"; +open( my \$fh, '>', '$tmp_fn' ) or die "Couldn't open '$tmp_fn':\$!"; my \$batch = \$self->TicketObj->TransactionBatch; unless ( \$batch && \@\$batch ) { diff --git a/rt/t/web/attachment_encoding.t b/rt/t/web/attachment_encoding.t index 6796c9969..9ba567746 100644 --- a/rt/t/web/attachment_encoding.t +++ b/rt/t/web/attachment_encoding.t @@ -48,7 +48,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE}; my $file = File::Spec->catfile( File::Spec->tmpdir, 'rt_attachemnt_abcde.txt' ); - open my $fh, '>', $file or die $!; + open( my $fh, '>', $file ) or die $!; binmode $fh, ':utf8'; print $fh '附件'; close $fh; diff --git a/rt/t/web/charting.t b/rt/t/web/charting.t new file mode 100644 index 000000000..7c11f9c92 --- /dev/null +++ b/rt/t/web/charting.t @@ -0,0 +1,69 @@ +use strict; +use warnings; + +use RT::Test no_plan => 1; + +for my $n (1..7) { + my $ticket = RT::Ticket->new( RT->SystemUser ); + my $req = 'root' . ($n % 2) . '@localhost'; + my ( $ret, $msg ) = $ticket->Create( + Subject => "base ticket $_", + Queue => "General", + Owner => "root", + Requestor => $req, + MIMEObj => MIME::Entity->build( + From => $req, + To => 'rt@localhost', + Subject => "base ticket $_", + Data => "Content $_", + ), + ); + ok( $ret, "ticket $n created: $msg" ); +} + +my ($url, $m) = RT::Test->started_ok; +ok( $m->login, "Logged in" ); + +# Test that defaults work +$m->get_ok( "/Search/Chart.html?Query=id>0" ); +$m->content_like(qr{<th[^>]*>\s*Queue\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>}, "Grouped by queue"); +$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7}, "Found results in table"); +$m->content_like(qr{<img src="/Search/Chart\?}, "Found image"); + +$m->get_ok( "/Search/Chart?Query=id>0" ); +is( $m->content_type, "image/png" ); +ok( length($m->content), "Has content" ); + + +# Group by Queue +$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Queue" ); +$m->content_like(qr{<th[^>]*>\s*Queue\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>}, "Grouped by queue"); +$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7}, "Found results in table"); +$m->content_like(qr{<img src="/Search/Chart\?}, "Found image"); + +$m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Queue" ); +is( $m->content_type, "image/png" ); +ok( length($m->content), "Has content" ); + + +# Group by Requestor email +$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.EmailAddress" ); +$m->content_like(qr{<th[^>]*>\s*Requestor\.EmailAddress\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>}, + "Grouped by requestor"); +$m->content_like(qr{root0\@localhost</a>\s*</td>\s*<td[^>]*>\s*3}, "Found results in table"); +$m->content_like(qr{<img src="/Search/Chart\?}, "Found image"); + +$m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Email" ); +is( $m->content_type, "image/png" ); +ok( length($m->content), "Has content" ); + + +# Group by Requestor phone -- which is bogus, and falls back to queue +$m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.Phone" ); +$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7}, + "Found queue results in table, as a default"); +$m->content_like(qr{<img src="/Search/Chart\?}, "Found image"); + +$m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Phone" ); +is( $m->content_type, "image/png" ); +ok( length($m->content), "Has content" ); diff --git a/rt/t/web/command_line.t b/rt/t/web/command_line.t index 3fc279bf3..884b064e6 100644 --- a/rt/t/web/command_line.t +++ b/rt/t/web/command_line.t @@ -532,7 +532,7 @@ sub check_attachment { expect_handle->before() =~ $attachment_regex; my $attachment_id = $1; expect_send("show ticket/$ticket_id/attachments/$attachment_id/content","Fetching Attachment"); - open (my $fh, $attachment_path) or die "Can't open $attachment_path: $!"; + open( my $fh, '<', $attachment_path ) or die "Can't open $attachment_path: $!"; my $attachment_content = do { local($/); <$fh> }; close $fh; chomp $attachment_content; diff --git a/rt/t/web/compilation_errors.t b/rt/t/web/compilation_errors.t index 4fd9c40e9..36a006890 100644 --- a/rt/t/web/compilation_errors.t +++ b/rt/t/web/compilation_errors.t @@ -5,7 +5,7 @@ use Test::More; use File::Find; BEGIN { sub wanted { - -f && /\.html$/ && $_ !~ /Logout.html$/; + -f && /\.html$/ && $_ !~ /Logout.html$/ && $File::Find::dir !~ /RichText/; } my $tests = 4; find( sub { wanted() and $tests += 4 }, 'share/html/' ); diff --git a/rt/t/web/path-traversal.t b/rt/t/web/path-traversal.t new file mode 100644 index 000000000..8d2f5cc88 --- /dev/null +++ b/rt/t/web/path-traversal.t @@ -0,0 +1,40 @@ +use strict; +use warnings; + +use RT::Test tests => 20; + +my ($baseurl, $agent) = RT::Test->started_ok; + +$agent->get("$baseurl/NoAuth/../Elements/HeaderJavascript"); +is($agent->status, 400); +$agent->warning_like(qr/Invalid request.*aborting/,); + +$agent->get("$baseurl/NoAuth/../%45lements/HeaderJavascript"); +is($agent->status, 400); +$agent->warning_like(qr/Invalid request.*aborting/,); + +$agent->get("$baseurl/NoAuth/%2E%2E/Elements/HeaderJavascript"); +is($agent->status, 400); +$agent->warning_like(qr/Invalid request.*aborting/,); + +$agent->get("$baseurl/NoAuth/../../../etc/RT_Config.pm"); +is($agent->status, 400); +$agent->warning_like(qr/Invalid request.*aborting/,); + +$agent->get("$baseurl/NoAuth/css/web2/images/../../../../../../etc/RT_Config.pm"); +is($agent->status, 400); +$agent->warning_like(qr/Invalid request.*aborting/,); + +# do not reject these URLs, even though they contain /. outside the path +$agent->get("$baseurl/index.html?ignored=%2F%2E"); +is($agent->status, 200); + +$agent->get("$baseurl/index.html?ignored=/."); +is($agent->status, 200); + +$agent->get("$baseurl/index.html#%2F%2E"); +is($agent->status, 200); + +$agent->get("$baseurl/index.html#/."); +is($agent->status, 200); + diff --git a/rt/t/web/private-components.t b/rt/t/web/private-components.t new file mode 100644 index 000000000..30e145f34 --- /dev/null +++ b/rt/t/web/private-components.t @@ -0,0 +1,40 @@ +use strict; + +use RT::Test tests => 20; +my ($baseurl, $agent) = RT::Test->started_ok; + +ok $agent->login, 'logged in'; + +$agent->get("/Elements/Refresh?Name=private"); +is($agent->status, 403); +$agent->content_lacks("private"); +$agent->content_lacks("Refresh this page every"); + +$agent->get("/Ticket/Elements/ShowTime?minutes=42"); +is($agent->status, 403); +$agent->content_lacks("42 min"); + +$agent->get("/Widgets/TitleBox?title=private"); +is($agent->status, 403); +$agent->content_lacks("private"); + +$agent->get("/autohandler"); +is($agent->status, 403); +$agent->content_lacks("comp called without component"); + +$agent->get("/NoAuth/js/autohandler"); +is($agent->status, 403); +$agent->content_lacks("no next component"); + +$agent->get("/l"); +is($agent->status, 403); +$agent->content_lacks("No handle/phrase"); + +$agent->get("/%61utohandler"); +is($agent->status, 403); +$agent->content_lacks("comp called without component"); + +$agent->get("/%45lements/Refresh?Name=private"); +is($agent->status, 403); +$agent->content_lacks("private"); +$agent->content_lacks("Refresh this page every"); diff --git a/rt/t/web/query_builder.t b/rt/t/web/query_builder.t index fa2c56da8..25d6ec5a3 100644 --- a/rt/t/web/query_builder.t +++ b/rt/t/web/query_builder.t @@ -5,7 +5,7 @@ use HTTP::Request::Common; use HTTP::Cookies; use LWP; use Encode; -use RT::Test tests => 44; +use RT::Test tests => 50; my $cookie_jar = HTTP::Cookies->new; my ($baseurl, $agent) = RT::Test->started_ok; @@ -256,3 +256,30 @@ diag "send query with not quoted negative number"; "query is the same" ); } + +diag "click advanced, enter an invalid SQL IS restriction, apply and check that we corrected it"; +{ + my $response = $agent->get($url."Search/Edit.html"); + ok( $response->is_success, "Fetched /Search/Edit.html" ); + ok($agent->form_number(3), "found the form"); + $agent->field("Query", "Requestor.EmailAddress IS 'FOOBAR'"); + $agent->submit; + is( getQueryFromForm($agent), + "Requestor.EmailAddress IS NULL", + "foobar is replaced by NULL" + ); +} + +diag "click advanced, enter an invalid SQL IS NOT restriction, apply and check that we corrected it"; +{ + my $response = $agent->get($url."Search/Edit.html"); + ok( $response->is_success, "Fetched /Search/Edit.html" ); + ok($agent->form_number(3), "found the form"); + $agent->field("Query", "Requestor.EmailAddress IS NOT 'FOOBAR'"); + $agent->submit; + is( getQueryFromForm($agent), + "Requestor.EmailAddress IS NOT NULL", + "foobar is replaced by NULL" + ); +} + diff --git a/rt/t/web/richtext-autohandler.t b/rt/t/web/richtext-autohandler.t new file mode 100644 index 000000000..56617b2fb --- /dev/null +++ b/rt/t/web/richtext-autohandler.t @@ -0,0 +1,13 @@ +use strict; + +use RT::Test tests => 7; +my ($baseurl, $agent) = RT::Test->started_ok; + +$agent->get("$baseurl/NoAuth/RichText/FCKeditor/license.txt"); +is($agent->status, 403); +$agent->content_lacks("It is not the purpose of this section to induce"); + +$agent->get_ok("/NoAuth/RichText/license.txt"); +$agent->content_contains("It is not the purpose of this section to induce"); + +$agent->warning_like(qr/Invalid request directly to the rich text editor/,); |