summaryrefslogtreecommitdiff
path: root/rt/t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t')
-rw-r--r--rt/t/api/ticket.t13
-rw-r--r--rt/t/lifecycles/basics.t2
-rw-r--r--rt/t/lifecycles/dates.t2
-rw-r--r--rt/t/lifecycles/moving.t2
-rw-r--r--rt/t/lifecycles/types.t2
-rw-r--r--rt/t/lifecycles/unresolved-deps.t2
-rw-r--r--rt/t/mail/gnupg-outgoing-encrypted-plaintext.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-encrypted.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-plain-plaintext.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-plain.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-signed-plaintext.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-signed.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t6
-rw-r--r--rt/t/mail/gnupg-outgoing-signed_encrypted.t6
-rw-r--r--rt/t/mail/mime_decoding.t10
-rw-r--r--rt/t/mail/one-time-recipients.t22
-rw-r--r--rt/t/shredder/02group_member.t17
-rw-r--r--rt/t/web/cf_groupings.t2
-rw-r--r--rt/t/web/cf_textarea.t11
-rw-r--r--rt/t/web/csrf.t14
-rw-r--r--rt/t/web/dashboards-in-menu.t22
-rw-r--r--rt/t/web/gnupg-select-keys-on-create.t47
-rw-r--r--rt/t/web/gnupg-select-keys-on-update.t45
-rw-r--r--rt/t/web/installer.t5
-rw-r--r--rt/t/web/language_update.t4
25 files changed, 195 insertions, 75 deletions
diff --git a/rt/t/api/ticket.t b/rt/t/api/ticket.t
index c5f1e240f..cfba3e97b 100644
--- a/rt/t/api/ticket.t
+++ b/rt/t/api/ticket.t
@@ -179,7 +179,20 @@ ok($ret, "Removed nobody as a squelched recipient - ".$msg);
@returned = $t->SquelchMailTo();
is($#returned, -1, "The ticket has no squelched recipients". join(',',@returned));
+@returned = $t->SquelchMailTo('somebody@example.com','nobody@example.com');
+is($#returned, 1, "The ticket has two squelched recipients, multiple args");
+@returned = $t->SquelchMailTo('third@example.com');
+is($#returned, 2, "The ticket has three squelched recipients, additive calls");
+
+my $t2 = RT::Ticket->new(RT->SystemUser);
+ok($t2->Create(Queue => 'general', Subject => 'SquelchTest', SquelchMailTo => [ 'nobody@example.com', 'test@example.com' ]));
+my @returned2 = $t2->SquelchMailTo();
+is($#returned2,1, "The ticket has two squelched recipients");
+
+$t2->SquelchMailTo('test@example.com');
+my @returned3 = $t2->SquelchMailTo();
+is($#returned2,1, "The ticket still has two squelched recipients, no duplicate squelchers");
}
diff --git a/rt/t/lifecycles/basics.t b/rt/t/lifecycles/basics.t
index e18bea3c4..85e77c732 100644
--- a/rt/t/lifecycles/basics.t
+++ b/rt/t/lifecycles/basics.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-BEGIN {require 't/lifecycles/utils.pl'};
+BEGIN {require './t/lifecycles/utils.pl'};
my $general = RT::Test->load_or_create_queue(
Name => 'General',
diff --git a/rt/t/lifecycles/dates.t b/rt/t/lifecycles/dates.t
index 0c74a1b21..a8dd8cfb6 100644
--- a/rt/t/lifecycles/dates.t
+++ b/rt/t/lifecycles/dates.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-BEGIN {require 't/lifecycles/utils.pl'};
+BEGIN {require './t/lifecycles/utils.pl'};
my $general = RT::Test->load_or_create_queue(
Name => 'General',
diff --git a/rt/t/lifecycles/moving.t b/rt/t/lifecycles/moving.t
index 8a03e3ea6..379b64697 100644
--- a/rt/t/lifecycles/moving.t
+++ b/rt/t/lifecycles/moving.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-BEGIN {require 't/lifecycles/utils.pl'};
+BEGIN {require './t/lifecycles/utils.pl'};
my $general = RT::Test->load_or_create_queue(
Name => 'General',
diff --git a/rt/t/lifecycles/types.t b/rt/t/lifecycles/types.t
index 79b0714b1..84cfd8627 100644
--- a/rt/t/lifecycles/types.t
+++ b/rt/t/lifecycles/types.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-BEGIN {require 't/lifecycles/utils.pl'};
+BEGIN {require './t/lifecycles/utils.pl'};
is_deeply( [ RT::Lifecycle->ListAll ], [qw/ approvals default delivery /],
"Get the list of all lifecycles (implicitly for for tickets)");
diff --git a/rt/t/lifecycles/unresolved-deps.t b/rt/t/lifecycles/unresolved-deps.t
index 5da4b8fc5..fe09d3bac 100644
--- a/rt/t/lifecycles/unresolved-deps.t
+++ b/rt/t/lifecycles/unresolved-deps.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-BEGIN {require 't/lifecycles/utils.pl'};
+BEGIN {require './t/lifecycles/utils.pl'};
my $general = RT::Test->load_or_create_queue(
Name => 'General',
diff --git a/rt/t/mail/gnupg-outgoing-encrypted-plaintext.t b/rt/t/mail/gnupg-outgoing-encrypted-plaintext.t
index 35cfceddd..7f0f7ac85 100644
--- a/rt/t/mail/gnupg-outgoing-encrypted-plaintext.t
+++ b/rt/t/mail/gnupg-outgoing-encrypted-plaintext.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 104,
+ tests => undef,
text_templates => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -10,7 +10,7 @@ use RT::Test::GnuPG
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -25,3 +25,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-encrypted.t b/rt/t/mail/gnupg-outgoing-encrypted.t
index 96c748794..dc6a55d29 100644
--- a/rt/t/mail/gnupg-outgoing-encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-encrypted.t
@@ -2,14 +2,14 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 103,
+ tests => undef,
gnupg_options => {
passphrase => 'rt-test',
'trust-model' => 'always',
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -24,3 +24,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-plain-plaintext.t b/rt/t/mail/gnupg-outgoing-plain-plaintext.t
index 32e7d5d8c..baf51e49f 100644
--- a/rt/t/mail/gnupg-outgoing-plain-plaintext.t
+++ b/rt/t/mail/gnupg-outgoing-plain-plaintext.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 104,
+ tests => undef,
text_templates => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -10,7 +10,7 @@ use RT::Test::GnuPG
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -23,3 +23,5 @@ my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-plain.t b/rt/t/mail/gnupg-outgoing-plain.t
index 62ae0ed49..f8f87e1c7 100644
--- a/rt/t/mail/gnupg-outgoing-plain.t
+++ b/rt/t/mail/gnupg-outgoing-plain.t
@@ -2,14 +2,14 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 103,
+ tests => undef,
gnupg_options => {
passphrase => 'rt-test',
'trust-model' => 'always',
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -22,3 +22,5 @@ my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-signed-plaintext.t b/rt/t/mail/gnupg-outgoing-signed-plaintext.t
index cf46edd52..0ff06d1ff 100644
--- a/rt/t/mail/gnupg-outgoing-signed-plaintext.t
+++ b/rt/t/mail/gnupg-outgoing-signed-plaintext.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 104,
+ tests => undef,
text_templates => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -10,7 +10,7 @@ use RT::Test::GnuPG
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -25,3 +25,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-signed.t b/rt/t/mail/gnupg-outgoing-signed.t
index 4aa262bee..00d292a40 100644
--- a/rt/t/mail/gnupg-outgoing-signed.t
+++ b/rt/t/mail/gnupg-outgoing-signed.t
@@ -2,14 +2,14 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 103,
+ tests => undef,
gnupg_options => {
passphrase => 'rt-test',
'trust-model' => 'always',
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -24,3 +24,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t b/rt/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
index c2753d00b..b21b34436 100644
--- a/rt/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
+++ b/rt/t/mail/gnupg-outgoing-signed_encrypted-plaintext.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 104,
+ tests => undef,
text_templates => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -10,7 +10,7 @@ use RT::Test::GnuPG
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -26,3 +26,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/gnupg-outgoing-signed_encrypted.t b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
index 806f62d95..1399c57ea 100644
--- a/rt/t/mail/gnupg-outgoing-signed_encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
@@ -2,14 +2,14 @@ use strict;
use warnings;
use RT::Test::GnuPG
- tests => 103,
+ tests => undef,
gnupg_options => {
passphrase => 'rt-test',
'trust-model' => 'always',
};
RT::Test->import_gnupg_key('rt-recipient@example.com');
-RT::Test->import_gnupg_key( 'rt-test@example.com', 'public' );
+RT::Test->import_gnupg_key( 'rt-test@example.com' );
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -25,3 +25,5 @@ ok $m->login, 'logged in';
create_and_test_outgoing_emails( $queue, $m );
+undef $m;
+done_testing;
diff --git a/rt/t/mail/mime_decoding.t b/rt/t/mail/mime_decoding.t
index 1126f1f84..97590712b 100644
--- a/rt/t/mail/mime_decoding.t
+++ b/rt/t/mail/mime_decoding.t
@@ -236,4 +236,14 @@ diag "quotes in filename";
);
}
+diag "Alternating encoded-words and not, space is preserved";
+{
+ my $str = q{A =?UTF-8?Q?B?= C =?UTF-8?Q?D?= E =?UTF-8?Q?F?= G};
+ is_string(
+ RT::I18N::DecodeMIMEWordsToUTF8($str, "Subject"),
+ q{A B C D E F G},
+ "Space is preserved between encoded-words and not"
+ );
+}
+
done_testing;
diff --git a/rt/t/mail/one-time-recipients.t b/rt/t/mail/one-time-recipients.t
index 1bc172d71..bdbcc523d 100644
--- a/rt/t/mail/one-time-recipients.t
+++ b/rt/t/mail/one-time-recipients.t
@@ -89,6 +89,28 @@ warnings_are {
);
ok $status, "replied to a ticket";
} { Cc => 'test@localhost' };
+}[];
+
+diag "Reply to ticket with multiple requestors squelched";
+warnings_are {
+ my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
+ mail_ok {
+ my ($status, undef, $msg) = $ticket->Create(
+ Queue => $queue->id,
+ Subject => 'test squelch',
+ Requestor => ['test@localhost','bob@localhost','fred@localhost' ],
+ );
+ ok $status, "created ticket";
+ } { To => 'bob@localhost, fred@localhost, test@localhost' };
+
+ mail_ok {
+ my ($status,$msg) = $ticket->Correspond(
+ Content => 'squelched email',
+ SquelchMailTo => ['bob@localhost', 'fred@localhost'],
+ );
+ ok $status, "replied to a ticket";
+ } { To => 'test@localhost' };
+
} [];
diag "Reply to ticket with requestor squelched";
diff --git a/rt/t/shredder/02group_member.t b/rt/t/shredder/02group_member.t
index 87d1e3ce7..692d361d3 100644
--- a/rt/t/shredder/02group_member.t
+++ b/rt/t/shredder/02group_member.t
@@ -3,7 +3,7 @@ use strict;
use warnings;
use Test::Deep;
-use RT::Test::Shredder tests => 34;
+use RT::Test::Shredder tests => 35;
my $test = "RT::Test::Shredder";
### nested membership check
@@ -38,8 +38,21 @@ my $test = "RT::Test::Shredder";
$members->Limit( FIELD => 'GroupId', VALUE => $cgid );
is( $members->Count, 1, "find membership record" );
+ my $transactions = RT::Transactions->new(RT->SystemUser);
+ $transactions->_OpenParen('member');
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'Type', VALUE => 'AddMember');
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'Field', VALUE => $user->PrincipalObj->id, ENTRYAGGREGATOR => 'AND' );
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'ObjectId', VALUE => $cgroup->id, ENTRYAGGREGATOR => 'AND' );
+ $transactions->_CloseParen('member');
+ $transactions->_OpenParen('member');
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'Type', VALUE => 'AddMembership');
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'Field', VALUE => $cgroup->PrincipalObj->id, ENTRYAGGREGATOR => 'AND' );
+ $transactions->Limit( SUBCLAUSE => 'member', FIELD => 'ObjectId', VALUE => $user->id, ENTRYAGGREGATOR => 'AND' );
+ $transactions->_CloseParen('member');
+ is( $transactions->Count, 2, "find membership transaction records" );
+
my $shredder = $test->shredder_new();
- $shredder->PutObjects( Objects => $members );
+ $shredder->PutObjects( Objects => [$members, $transactions] );
$shredder->WipeoutAll();
$test->db_is_valid;
cmp_deeply( $test->dump_current_and_savepoint('buadd'), "current DB equal to savepoint");
diff --git a/rt/t/web/cf_groupings.t b/rt/t/web/cf_groupings.t
index 0a40f71af..03ca60ad5 100644
--- a/rt/t/web/cf_groupings.t
+++ b/rt/t/web/cf_groupings.t
@@ -65,7 +65,7 @@ my $id = $m->get_ticket_id;
foreach my $grouping (@groupings) {
my $row_id = "CF-$CF{$grouping}-ShowRow";
is $dom->find(qq{#$row_id})->size, 1, "CF on the page";
- is $dom->at(qq{#$row_id})->all_text, "Test$grouping: Test${grouping}Value", "value is set";
+ like $dom->at(qq{#$row_id})->all_text, qr/Test$grouping:\s*Test${grouping}Value/, "value is set";
ok $dom->at(qq{$location{$grouping} #$row_id}), "CF is in the right place";
}
}
diff --git a/rt/t/web/cf_textarea.t b/rt/t/web/cf_textarea.t
index d11bda4d5..444020eae 100644
--- a/rt/t/web/cf_textarea.t
+++ b/rt/t/web/cf_textarea.t
@@ -27,6 +27,10 @@ my $cfs = {
type => 'FreeformSingle',
name => 'TheControlField',
},
+ zero => {
+ type => 'FreeformSingle',
+ name => 'Zero',
+ },
};
while ( my( $label, $data ) = each %$cfs ) {
@@ -55,10 +59,13 @@ $m->submit_form_ok({
$cfs->{area}{input} . '-Magic' => "1",
$cfs->{text}{input} => 'value a',
$cfs->{text}{input} . '-Magic' => "1",
+ $cfs->{zero}{input} => '0',
+ $cfs->{zero}{input} . '-Magic' => "1",
},
}, 'submitted form to initially set CFs');
$m->content_contains('<li>TheControlField value a added</li>');
$m->content_contains("<li>TheTextarea $content added</li>", 'content found');
+$m->content_contains("<li>Zero 0 added</li>", 'zero field found');
# http://issues.bestpractical.com/Ticket/Display.html?id=30378
# #30378: RT 4.2.6 - Very long text fields get updated even when they haven't changed
@@ -71,5 +78,9 @@ $m->submit_form_ok({
$m->content_contains('<li>TheControlField value a changed to value b</li>');
$m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea wasnt updated');
+# http://issues.bestpractical.com/Ticket/Display.html?id=32440
+# #32440: Spurious "CF changed from 0 to 0"
+$m->content_lacks("<li>Zero 0 changed to 0</li>", "Zero wasn't updated");
+
undef $m;
done_testing;
diff --git a/rt/t/web/csrf.t b/rt/t/web/csrf.t
index 3fea28788..ca52122ff 100644
--- a/rt/t/web/csrf.t
+++ b/rt/t/web/csrf.t
@@ -87,7 +87,7 @@ $m->content_lacks('Possible cross-site request forgery');
$m->add_header(Referer => 'http://example.net');
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("the Referrer header supplied by your browser (example.net:80) is not allowed");
$m->title_is('Possible cross-site request forgery');
@@ -109,7 +109,7 @@ $m->title_is('#1: bad music');
# now a non-whitelisted argument
$m->get_ok("/Ticket/Display.html?id=1&Action=Take");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Display.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Display.html</tt>");
$m->content_contains("the Referrer header supplied by your browser (example.net:80) is not allowed");
$m->title_is('Possible cross-site request forgery');
@@ -124,7 +124,7 @@ $m->content_contains('Owner changed from Nobody to root');
$m->add_header(Referer => undef);
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -138,7 +138,7 @@ $m->title_is('Create a new ticket');
$m->add_header(Referer => undef);
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -161,7 +161,7 @@ my ($token) = $m->content =~ m{CSRF_Token=(\w+)};
$m->add_header(Referer => undef);
$m->get_ok("/Admin/Queues/Modify.html?id=new&Name=test&CSRF_Token=$token");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Admin/Queues/Modify.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Admin/Queues/Modify.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -194,7 +194,7 @@ $m->field('Attach', $logofile);
$m->add_header(Referer => undef);
$m->submit;
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->follow_link(text_regex => qr{resume your request});
$m->content_contains('Download bpslogo.png', 'page has file name');
$m->follow_link_ok({text => "Download bpslogo.png"});
@@ -214,7 +214,7 @@ $m->content_contains("My open tickets", "got self-service interface");
$m->add_header(Referer => undef);
$m->get_ok("/SelfService/Create.html?Queue=1");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/SelfService/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/SelfService/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
diff --git a/rt/t/web/dashboards-in-menu.t b/rt/t/web/dashboards-in-menu.t
index 3126d55c3..8333313bf 100644
--- a/rt/t/web/dashboards-in-menu.t
+++ b/rt/t/web/dashboards-in-menu.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 31;
+use RT::Test tests => undef;
my ($baseurl, $m) = RT::Test->started_ok;
my $system_foo = RT::Dashboard->new($RT::SystemUser);
@@ -75,11 +75,29 @@ $m->content_contains( 'Preferences saved for dashboards in menu.',
'prefs saved' );
$m->follow_link_ok( { text => 'self bar' }, 'follow self bar link' );
$m->title_is( 'self bar Dashboard', 'got self bar dashboard page' );
+
+diag "Test deleting dashboard";
+$m->follow_link_ok( { text => 'self foo' }, 'follow self foo link' );
+$m->follow_link_ok( { text => 'Basics' }, 'Click dashboard Basics' );
+$m->form_name('ModifyDashboard');
+$m->click_button(name => 'Delete');
+
+diag "Reset dashboard menu";
$m->get_ok( $baseurl."/Prefs/DashboardsInMenu.html");
$m->form_with_fields('Reset');
$m->click;
$m->content_contains( 'Preferences saved', 'prefs saved' );
ok( $m->find_link( text => 'system foo' ), 'got system foo link' );
-ok( !$m->find_link( text => 'self foo' ), 'no self foo link' );
ok( !$m->find_link( text => 'self bar' ), 'no self bar link' );
+diag "Delete system dashboard";
+$m->get_ok( $baseurl . "/Dashboards/index.html" );
+$m->follow_link_ok( { text => 'system foo' }, 'follow self foo link' );
+$m->follow_link_ok( { text => 'Basics' }, 'Click dashboard Basics' );
+$m->form_name('ModifyDashboard');
+$m->click_button(name => 'Delete');
+$m->get_ok( $baseurl . "/Dashboards/index.html" );
+$m->content_lacks('system foo', 'Dashboard is deleted');
+
+undef $m;
+done_testing;
diff --git a/rt/t/web/gnupg-select-keys-on-create.t b/rt/t/web/gnupg-select-keys-on-create.t
index e30b264d9..131f4c5cd 100644
--- a/rt/t/web/gnupg-select-keys-on-create.t
+++ b/rt/t/web/gnupg-select-keys-on-create.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test::GnuPG tests => 79, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
my $queue = RT::Test->load_or_create_queue(
@@ -73,7 +73,7 @@ diag "check that things don't work if there is no key";
diag "import first key of rt-test\@example.com";
my $fpr1 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
@@ -122,7 +122,7 @@ diag "check that things still doesn't work if key is not trusted";
diag "import a second key of rt-test\@example.com";
my $fpr2 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com.2', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com.2', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
@@ -239,37 +239,44 @@ diag "check that key selector works and we can select trusted key";
}
diag "check encrypting of attachments";
-{
+for my $encrypt (0, 1) {
RT::Test->clean_caught_mails;
ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
$m->form_name('TicketCreate');
- $m->tick( Encrypt => 1 );
- $m->field( Requestors => 'rt-test@example.com' );
+ $m->tick( Encrypt => 1 ) if $encrypt;
+ $m->field( Requestors => '' );
+ $m->field( Cc => 'rt-test@example.com' );
$m->field( Content => 'Some content' );
$m->field( Attach => $0 );
$m->submit;
- $m->content_contains(
- 'You are going to encrypt outgoing email messages',
- 'problems with keys'
- );
- $m->content_contains(
- 'There are several keys suitable for encryption',
- 'problems with keys'
- );
- my $form = $m->form_name('TicketCreate');
- ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
- is scalar $input->possible_values, 2, 'two options';
+ if ($encrypt) {
+ $m->content_contains(
+ 'You are going to encrypt outgoing email messages',
+ 'problems with keys'
+ );
+ $m->content_contains(
+ 'There are several keys suitable for encryption',
+ 'problems with keys'
+ );
+
+ my $form = $m->form_name('TicketCreate');
+ ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
+ $m->submit;
+ }
- $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
- $m->submit;
$m->content_like( qr/Ticket \d+ created in queue/i, 'ticket created' );
my @mail = RT::Test->fetch_caught_mails;
ok @mail, 'there are some emails';
- check_text_emails( { Encrypt => 1, Attachment => 1 }, @mail );
+ check_text_emails( { Encrypt => $encrypt, Attachment => "Attachment content" }, @mail );
$m->no_warnings_ok;
}
+undef $m;
+done_testing;
diff --git a/rt/t/web/gnupg-select-keys-on-update.t b/rt/t/web/gnupg-select-keys-on-update.t
index a666851db..24d22e708 100644
--- a/rt/t/web/gnupg-select-keys-on-update.t
+++ b/rt/t/web/gnupg-select-keys-on-update.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test::GnuPG tests => 86, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
@@ -90,7 +90,7 @@ diag "check that things don't work if there is no key";
diag "import first key of rt-test\@example.com";
my $fpr1 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
@@ -140,7 +140,7 @@ diag "check that things still doesn't work if key is not trusted";
diag "import a second key of rt-test\@example.com";
my $fpr2 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com.2', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com.2', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
@@ -260,37 +260,44 @@ diag "check that key selector works and we can select trusted key";
}
diag "check encrypting of attachments";
-{
+for my $encrypt (0, 1) {
RT::Test->clean_caught_mails;
ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
$m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
$m->form_name('TicketUpdate');
- $m->tick( Encrypt => 1 );
+ $m->tick( Encrypt => 1 ) if $encrypt;
$m->field( UpdateCc => 'rt-test@example.com' );
$m->field( UpdateContent => 'Some content' );
$m->field( Attach => $0 );
$m->click('SubmitTicket');
- $m->content_contains(
- 'You are going to encrypt outgoing email messages',
- 'problems with keys'
- );
- $m->content_contains(
- 'There are several keys suitable for encryption',
- 'problems with keys'
- );
- my $form = $m->form_name('TicketUpdate');
- ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
- is scalar $input->possible_values, 2, 'two options';
+ if ($encrypt) {
+ $m->content_contains(
+ 'You are going to encrypt outgoing email messages',
+ 'problems with keys'
+ );
+ $m->content_contains(
+ 'There are several keys suitable for encryption',
+ 'problems with keys'
+ );
+
+ my $form = $m->form_name('TicketUpdate');
+ ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
+ $m->click('SubmitTicket');
+ }
- $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
- $m->click('SubmitTicket');
$m->content_contains('Correspondence added', 'Correspondence added' );
my @mail = RT::Test->fetch_caught_mails;
ok @mail, 'there are some emails';
- check_text_emails( { Encrypt => 1, Attachment => 1 }, @mail );
+ check_text_emails( { Encrypt => $encrypt, Attachment => "Attachment content" }, @mail );
$m->no_warnings_ok;
}
+
+undef $m;
+done_testing;
diff --git a/rt/t/web/installer.t b/rt/t/web/installer.t
index 79198a7e8..a690e1a22 100644
--- a/rt/t/web/installer.t
+++ b/rt/t/web/installer.t
@@ -71,9 +71,12 @@ diag "Walking through install screens setting defaults";
}, 'set root password');
# Mail options
+ my $sendmail = File::Spec->rel2abs( File::Spec->catfile(
+ 't', 'security', 'fake-sendmail' ) );
$m->submit_form_ok({
with_fields => {
- OwnerEmail => 'admin@example.com',
+ OwnerEmail => 'admin@example.com',
+ SendmailPath => $sendmail,
},
}, 'set admin email');
diff --git a/rt/t/web/language_update.t b/rt/t/web/language_update.t
index 35082f886..61e094d82 100644
--- a/rt/t/web/language_update.t
+++ b/rt/t/web/language_update.t
@@ -10,13 +10,13 @@ $m->form_with_fields('Lang');
$m->field(Lang => 'zh_TW');
$m->submit;
-$m->text_contains(Encode::decode("UTF-8","並讓現存的 iCal feeds不再能用"), "successfully updated to zh_TW");
+$m->text_contains(Encode::decode("UTF-8","電子郵件信箱"), "successfully updated to zh_TW");
$m->text_contains(Encode::decode("UTF-8","使用語言 的值從 (無) 改為 'zh_TW'"), "when updating to language zh_TW, results are in zh_TW");
$m->form_with_fields('Lang');
$m->field(Lang => 'en_us');
$m->submit;
-$m->text_contains("breaking all existing iCal feeds", "successfully updated to en_us");
+$m->text_contains("Email", "successfully updated to en_us");
$m->text_contains("Lang changed from 'zh_TW' to 'en_us'", "when updating to language en_us, results are in en_us");