summaryrefslogtreecommitdiff
path: root/rt/t/web
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/web')
-rw-r--r--rt/t/web/admin_groups.t1
-rw-r--r--rt/t/web/admin_user.t63
-rw-r--r--rt/t/web/attachment_encoding.t1
-rw-r--r--rt/t/web/attachments.t2
-rw-r--r--rt/t/web/basic.t1
-rw-r--r--rt/t/web/case-sensitivity.t2
-rw-r--r--rt/t/web/cf_access.t2
-rw-r--r--rt/t/web/cf_date.t1
-rw-r--r--rt/t/web/cf_datetime.t1
-rw-r--r--rt/t/web/cf_onqueue.t2
-rw-r--r--rt/t/web/cf_select_one.t1
-rw-r--r--rt/t/web/class_create.t2
-rw-r--r--rt/t/web/clickjacking-preventions.t1
-rw-r--r--rt/t/web/command_line.t18
-rw-r--r--rt/t/web/command_line_with_unknown_field.t14
-rw-r--r--rt/t/web/compilation_errors.t5
-rw-r--r--rt/t/web/config_tab_right.t1
-rw-r--r--rt/t/web/crypt-gnupg.t2
-rw-r--r--rt/t/web/csrf-rest.t1
-rw-r--r--rt/t/web/csrf.t1
-rw-r--r--rt/t/web/custom_frontpage.t23
-rw-r--r--rt/t/web/custom_search.t2
-rw-r--r--rt/t/web/dashboards-basics.t2
-rw-r--r--rt/t/web/dashboards-deleted-saved-search.t1
-rw-r--r--rt/t/web/dashboards-groups.t2
-rw-r--r--rt/t/web/dashboards-permissions.t1
-rw-r--r--rt/t/web/dashboards-search-cache.t2
-rw-r--r--rt/t/web/gnupg-headers.t2
-rw-r--r--rt/t/web/gnupg-select-keys-on-create.t1
-rw-r--r--rt/t/web/gnupg-select-keys-on-update.t1
-rw-r--r--rt/t/web/gnupg-tickyboxes.t1
-rw-r--r--rt/t/web/googleish_search.t1
-rw-r--r--rt/t/web/group_create.t2
-rw-r--r--rt/t/web/html_template.t3
-rw-r--r--rt/t/web/installer.t11
-rw-r--r--rt/t/web/logout.t1
-rw-r--r--rt/t/web/offline.t1
-rw-r--r--rt/t/web/offline_messages_utf8.t1
-rw-r--r--rt/t/web/offline_utf8.t1
-rw-r--r--rt/t/web/owner_disabled_group_19221.t1
-rw-r--r--rt/t/web/passthrough-jsmin1
-rw-r--r--rt/t/web/private-components.t1
-rw-r--r--rt/t/web/query_builder.t3
-rw-r--r--rt/t/web/query_builder_queue_limits.t16
-rw-r--r--rt/t/web/query_log.t1
-rw-r--r--rt/t/web/queue_caching.t30
-rw-r--r--rt/t/web/queue_create.t2
-rw-r--r--rt/t/web/quickcreate.t1
-rw-r--r--rt/t/web/quicksearch.t1
-rw-r--r--rt/t/web/redirect-after-login.t1
-rw-r--r--rt/t/web/redirect.t2
-rw-r--r--rt/t/web/reminders.t26
-rw-r--r--rt/t/web/requestor_groups_edit_link.t1
-rw-r--r--rt/t/web/requestor_groups_limit.t1
-rw-r--r--rt/t/web/rest-non-ascii-subject.t1
-rw-r--r--rt/t/web/rest-sort.t1
-rw-r--r--rt/t/web/rest.t181
-rw-r--r--rt/t/web/richtext-autohandler.t1
-rw-r--r--rt/t/web/rights.t1
-rw-r--r--rt/t/web/rights1.t2
-rw-r--r--rt/t/web/saved_search_chart.t1
-rw-r--r--rt/t/web/saved_search_context.t1
-rw-r--r--rt/t/web/saved_search_permissions.t1
-rw-r--r--rt/t/web/saved_search_update.t1
-rw-r--r--rt/t/web/scrips.t2
-rw-r--r--rt/t/web/scrub.t1
-rw-r--r--rt/t/web/search_bulk_update_links.t1
-rw-r--r--rt/t/web/search_rss.t3
-rw-r--r--rt/t/web/search_tabs.t4
-rw-r--r--rt/t/web/template.t35
-rw-r--r--rt/t/web/ticket-create-utf8.t1
-rw-r--r--rt/t/web/ticket_display.t14
-rw-r--r--rt/t/web/ticket_forward.t1
-rw-r--r--rt/t/web/ticket_modify_all.t4
-rw-r--r--rt/t/web/ticket_owner.t1
-rw-r--r--rt/t/web/ticket_owner_autocomplete.t1
-rw-r--r--rt/t/web/ticket_owner_issues_16656.t1
-rw-r--r--rt/t/web/ticket_seen.t1
-rw-r--r--rt/t/web/ticket_txn_content.t2
-rw-r--r--rt/t/web/ticket_update_without_content.t1
-rw-r--r--rt/t/web/unlimited_search.t3
-rw-r--r--rt/t/web/user_update.t31
-rw-r--r--rt/t/web/walk.t1
83 files changed, 434 insertions, 134 deletions
diff --git a/rt/t/web/admin_groups.t b/rt/t/web/admin_groups.t
index 783b5ad..075fb62 100644
--- a/rt/t/web/admin_groups.t
+++ b/rt/t/web/admin_groups.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/admin_user.t b/rt/t/web/admin_user.t
index fde075f..36b9af1 100644
--- a/rt/t/web/admin_user.t
+++ b/rt/t/web/admin_user.t
@@ -1,9 +1,19 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 7;
+use RT::Test::GnuPG
+ tests => undef,
+ gnupg_options => {
+ passphrase => 'recipient',
+ 'trust-model' => 'always',
+ };
+
+RT::Test->import_gnupg_key( 'rt-test@example.com', 'secret' );
+
+ok( my $user = RT::User->new( RT->SystemUser ) );
+ok( $user->Load('root'), "loaded user 'root'" );
+$user->SetEmailAddress('rt-test@example.com');
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login(), 'logged in' );
@@ -17,5 +27,54 @@ diag "test the history page" if $ENV{TEST_VERBOSE};
$m->get_ok( $url . '/Admin/Users/History.html?id=' . $root->id );
$m->content_contains('User created', 'has User created entry');
+diag "test gnupg page" if $ENV{TEST_VERBOSE};
+$m->follow_link_ok( { text => 'GnuPG' } );
+$m->content_contains('GnuPG public key');
+$m->content_contains('The key is ultimately trusted');
+$m->content_contains('F0CB3B482CFA485680A4A0BDD328035D84881F1B');
+$m->content_contains('Tue Aug 07 2007');
+$m->content_contains('never');
+
+$m->content_contains('GnuPG private key');
+
+my $form = $m->form_with_fields('PrivateKey');
+is( $form->find_input('PrivateKey')->value,
+ '__empty_value__', 'default no private key' );
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => 'D328035D84881F1B' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+
+$m->content_contains('Set private key');
+$form = $m->form_with_fields('PrivateKey');
+is( $form->find_input('PrivateKey')->value,
+ 'D328035D84881F1B', 'set private key' );
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => '__empty_value__' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+
+$m->content_contains('Unset private key');
+is( $form->find_input('PrivateKey')->value,
+ '__empty_value__', 'unset private key' );
+$form = $m->form_with_fields('PrivateKey');
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => 'C798591AA831DBFB' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+is( $form->find_input('PrivateKey')->value,
+ 'C798591AA831DBFB', 'set private key' );
+
# TODO more /Admin/Users tests
+undef $m;
+done_testing;
diff --git a/rt/t/web/attachment_encoding.t b/rt/t/web/attachment_encoding.t
index bfbf245..5af7fda 100644
--- a/rt/t/web/attachment_encoding.t
+++ b/rt/t/web/attachment_encoding.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/attachments.t b/rt/t/web/attachments.t
index 784cbbe..b518ec1 100644
--- a/rt/t/web/attachments.t
+++ b/rt/t/web/attachments.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 33;
diff --git a/rt/t/web/basic.t b/rt/t/web/basic.t
index 31e28c4..e61e80e 100644
--- a/rt/t/web/basic.t
+++ b/rt/t/web/basic.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/case-sensitivity.t b/rt/t/web/case-sensitivity.t
index f984bf3..f9c61b5 100644
--- a/rt/t/web/case-sensitivity.t
+++ b/rt/t/web/case-sensitivity.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/cf_access.t b/rt/t/web/cf_access.t
index 73b7765..675fa21 100644
--- a/rt/t/web/cf_access.t
+++ b/rt/t/web/cf_access.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 32;
diff --git a/rt/t/web/cf_date.t b/rt/t/web/cf_date.t
index 887aa42..4ea93e4 100644
--- a/rt/t/web/cf_date.t
+++ b/rt/t/web/cf_date.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/cf_datetime.t b/rt/t/web/cf_datetime.t
index 9781c5e..8cc099d 100644
--- a/rt/t/web/cf_datetime.t
+++ b/rt/t/web/cf_datetime.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/cf_onqueue.t b/rt/t/web/cf_onqueue.t
index 422eeff..bd6ae66 100644
--- a/rt/t/web/cf_onqueue.t
+++ b/rt/t/web/cf_onqueue.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 14;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/cf_select_one.t b/rt/t/web/cf_select_one.t
index 15fe416..92fcf53 100644
--- a/rt/t/web/cf_select_one.t
+++ b/rt/t/web/cf_select_one.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/class_create.t b/rt/t/web/class_create.t
index cec41a8..2d9ad03 100644
--- a/rt/t/web/class_create.t
+++ b/rt/t/web/class_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/clickjacking-preventions.t b/rt/t/web/clickjacking-preventions.t
index dde8295..e3f7f44 100644
--- a/rt/t/web/clickjacking-preventions.t
+++ b/rt/t/web/clickjacking-preventions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/command_line.t b/rt/t/web/command_line.t
index 394daab..7c444f4 100644
--- a/rt/t/web/command_line.t
+++ b/rt/t/web/command_line.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use Test::Expect;
-use RT::Test tests => 315, actual_server => 1;
+use RT::Test tests => undef, actual_server => 1;
my ($baseurl, $m) = RT::Test->started_ok;
use RT::User;
@@ -83,6 +82,16 @@ TODO: {
expect_like(qr/$queue_id: EditedQueue$$/, 'Found the queue');
}
+# Queues with spaces in their names
+expect_send("create -t queue set Name='Spaced Out'", 'Creating a queue...');
+expect_like(qr/Queue \d+ created/, 'Created the queue');
+expect_handle->before() =~ /Queue (\d+) created/;
+my $other_queue = $1;
+ok($other_queue, "Got queue id=$other_queue");
+expect_send("show 'queue/Spaced Out'", 'Showing the queue...');
+expect_like(qr/id: queue\/$other_queue/, 'Saw the queue');
+expect_like(qr/Name: Spaced Out/, 'Saw the modification');
+
# Set up a custom field for editing tests
@@ -536,4 +545,7 @@ sub check_attachment {
my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
is( scalar @warnings, 0, 'no extra warnings' );
+undef $m;
+done_testing;
+
1; # needed to avoid a weird exit value from expect_quit
diff --git a/rt/t/web/command_line_with_unknown_field.t b/rt/t/web/command_line_with_unknown_field.t
index d63956b..6afad8a 100644
--- a/rt/t/web/command_line_with_unknown_field.t
+++ b/rt/t/web/command_line_with_unknown_field.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use Test::Expect;
-use RT::Test tests => 17, actual_server => 1;
+use RT::Test tests => 21, actual_server => 1;
my ($baseurl, $m) = RT::Test->started_ok;
my $rt_tool_path = "$RT::BinPath/rt";
@@ -38,6 +37,15 @@ expect_send("edit ticket/$ticket_id set homer=simpson", 'set unknown field');
expect_like(qr/homer: Unknown field/, 'homer is unknown field');
expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
+expect_send(
+ q{create -t ticket set requestors='foo@example.com, bar@example.com'},
+ "create ticket with field 'requestors'" );
+expect_like(qr/Ticket \d+ created/, "Created the ticket");
+expect_handle->before() =~ /Ticket (\d+) created/;
+$ticket_id = $1;
+expect_send("show ticket/$ticket_id", 'check requestors');
+expect_like(qr/From: (?:foo\@example\.com, bar\@example\.com|bar\@example\.com, foo\@example\.com)/, "requestors are set correctly");
+
expect_quit();
# you may encounter warning like Use of uninitialized value $ampm
diff --git a/rt/t/web/compilation_errors.t b/rt/t/web/compilation_errors.t
index 1f82ab9..0ae6ead 100644
--- a/rt/t/web/compilation_errors.t
+++ b/rt/t/web/compilation_errors.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use Test::More;
use File::Find;
BEGIN {
@@ -9,7 +8,7 @@ BEGIN {
}
my $tests = 8;
find( sub { wanted() and $tests += 4 }, 'share/html/' );
- plan tests => $tests;
+ plan tests => $tests + 1; # plus one for warnings check
}
diff --git a/rt/t/web/config_tab_right.t b/rt/t/web/config_tab_right.t
index 361506c..69bf80c 100644
--- a/rt/t/web/config_tab_right.t
+++ b/rt/t/web/config_tab_right.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/crypt-gnupg.t b/rt/t/web/crypt-gnupg.t
index b30edc3..1743a3a 100644
--- a/rt/t/web/crypt-gnupg.t
+++ b/rt/t/web/crypt-gnupg.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test::GnuPG
tests => 102,
diff --git a/rt/t/web/csrf-rest.t b/rt/t/web/csrf-rest.t
index 5bb9081..d909c4a 100644
--- a/rt/t/web/csrf-rest.t
+++ b/rt/t/web/csrf-rest.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/csrf.t b/rt/t/web/csrf.t
index d99b4ce..24aae40 100644
--- a/rt/t/web/csrf.t
+++ b/rt/t/web/csrf.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/custom_frontpage.t b/rt/t/web/custom_frontpage.t
index 43c5f6e..ee5e9f5 100644
--- a/rt/t/web/custom_frontpage.t
+++ b/rt/t/web/custom_frontpage.t
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
-use RT::Test tests => 12;
+use RT::Test tests => 19;
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
@@ -88,3 +88,22 @@ $m->click_button( name => 'add' );
$m->get($url);
$m->content_like( qr/special chars \[test\] \d+ \[_1\]/,
'special chars in titlebox' );
+
+
+# Edit a system saved search to contain "[more]"
+{
+ my $search = RT::Attribute->new( RT->SystemUser );
+ $search->LoadByNameAndObject( Name => 'Search - My Tickets', Object => RT->System );
+ my ($id, $desc) = ($search->id, RT->SystemUser->loc($search->Description, '"N"'));
+ ok $id, 'loaded search attribute';
+
+ $m->get_ok($url);
+ $m->follow_link_ok({ url_regex => qr"Prefs/Search\.html\?name=.+?Attribute-$id" }, 'Edit link');
+ $m->content_contains($desc, "found description: $desc");
+
+ ok +($search->SetDescription( $search->Description . " [more]" ));
+
+ $m->get_ok($m->uri); # "reload_ok"
+ $m->content_contains($desc . " [more]", "found description: $desc");
+}
+
diff --git a/rt/t/web/custom_search.t b/rt/t/web/custom_search.t
index f8fde25..bf7d659 100644
--- a/rt/t/web/custom_search.t
+++ b/rt/t/web/custom_search.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 13;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-basics.t b/rt/t/web/dashboards-basics.t
index 1d56da5..edb7068 100644
--- a/rt/t/web/dashboards-basics.t
+++ b/rt/t/web/dashboards-basics.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 122;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-deleted-saved-search.t b/rt/t/web/dashboards-deleted-saved-search.t
index 4cd7fea..cb96aca 100644
--- a/rt/t/web/dashboards-deleted-saved-search.t
+++ b/rt/t/web/dashboards-deleted-saved-search.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/dashboards-groups.t b/rt/t/web/dashboards-groups.t
index ac2a5ac..db2fccf 100644
--- a/rt/t/web/dashboards-groups.t
+++ b/rt/t/web/dashboards-groups.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test nodata => 1, tests => 64;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-permissions.t b/rt/t/web/dashboards-permissions.t
index f2e59e5..433fdd3 100644
--- a/rt/t/web/dashboards-permissions.t
+++ b/rt/t/web/dashboards-permissions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/dashboards-search-cache.t b/rt/t/web/dashboards-search-cache.t
index ad2a969..517e26e 100644
--- a/rt/t/web/dashboards-search-cache.t
+++ b/rt/t/web/dashboards-search-cache.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 20;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/gnupg-headers.t b/rt/t/web/gnupg-headers.t
index 88b3ab9..03e6090 100644
--- a/rt/t/web/gnupg-headers.t
+++ b/rt/t/web/gnupg-headers.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test::GnuPG
tests => 15,
diff --git a/rt/t/web/gnupg-select-keys-on-create.t b/rt/t/web/gnupg-select-keys-on-create.t
index cf27e48..893ae65 100644
--- a/rt/t/web/gnupg-select-keys-on-create.t
+++ b/rt/t/web/gnupg-select-keys-on-create.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/gnupg-select-keys-on-update.t b/rt/t/web/gnupg-select-keys-on-update.t
index 4842dcd..1509d1d 100644
--- a/rt/t/web/gnupg-select-keys-on-update.t
+++ b/rt/t/web/gnupg-select-keys-on-update.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/gnupg-tickyboxes.t b/rt/t/web/gnupg-tickyboxes.t
index 9445397..eb4388a 100644
--- a/rt/t/web/gnupg-tickyboxes.t
+++ b/rt/t/web/gnupg-tickyboxes.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/googleish_search.t b/rt/t/web/googleish_search.t
index f4c8fa4..a5f834e 100644
--- a/rt/t/web/googleish_search.t
+++ b/rt/t/web/googleish_search.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/group_create.t b/rt/t/web/group_create.t
index 26da592..548970d 100644
--- a/rt/t/web/group_create.t
+++ b/rt/t/web/group_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/html_template.t b/rt/t/web/html_template.t
index 662a26b..78b95a3 100644
--- a/rt/t/web/html_template.t
+++ b/rt/t/web/html_template.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -32,7 +31,7 @@ Content-Type: text/html
EOF
},
);
- $m->content_like( qr/Content changed/, 'content is changed' );
+ $m->content_like( qr/Content updated/, 'content is changed' );
$m->content_contains( '你好', 'content is really updated' );
}
diff --git a/rt/t/web/installer.t b/rt/t/web/installer.t
index 4dc82df..a34cdcb 100644
--- a/rt/t/web/installer.t
+++ b/rt/t/web/installer.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -52,7 +51,14 @@ diag "Walking through install screens setting defaults";
# Database details
$m->content_contains('DatabaseName');
- $m->submit();
+ if (RT->Config->Get('DatabaseType') eq 'SQLite') {
+ $m->submit;
+ } else {
+ $m->submit_form(with_fields => {
+ DatabaseAdmin => $ENV{RT_DBA_USER},
+ DatabaseAdminPassword => $ENV{RT_DBA_PASSWORD},
+ });
+ }
$m->content_contains('Connection succeeded');
$m->submit_form_ok({ button => 'Next' });
@@ -91,5 +97,6 @@ diag "Walking through install screens setting defaults";
ok $m->login(), 'logged in';
}
+RT::Test::__drop_database();
undef $m;
done_testing;
diff --git a/rt/t/web/logout.t b/rt/t/web/logout.t
index 889e5fc..73ff25c 100644
--- a/rt/t/web/logout.t
+++ b/rt/t/web/logout.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/offline.t b/rt/t/web/offline.t
index b3762fc..06d5191 100644
--- a/rt/t/web/offline.t
+++ b/rt/t/web/offline.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/offline_messages_utf8.t b/rt/t/web/offline_messages_utf8.t
index bf9cf39..4518c7b 100644
--- a/rt/t/web/offline_messages_utf8.t
+++ b/rt/t/web/offline_messages_utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/offline_utf8.t b/rt/t/web/offline_utf8.t
index 24795c0..c317a46 100644
--- a/rt/t/web/offline_utf8.t
+++ b/rt/t/web/offline_utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/owner_disabled_group_19221.t b/rt/t/web/owner_disabled_group_19221.t
index 2664c5b..d41decf 100644
--- a/rt/t/web/owner_disabled_group_19221.t
+++ b/rt/t/web/owner_disabled_group_19221.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/passthrough-jsmin b/rt/t/web/passthrough-jsmin
index 3d9bf01..41b0196 100644
--- a/rt/t/web/passthrough-jsmin
+++ b/rt/t/web/passthrough-jsmin
@@ -1,4 +1,3 @@
-#!/bin/sh
echo "// passthrough-jsmin added this";
diff --git a/rt/t/web/private-components.t b/rt/t/web/private-components.t
index ceb2b34..3ece854 100644
--- a/rt/t/web/private-components.t
+++ b/rt/t/web/private-components.t
@@ -1,4 +1,5 @@
use strict;
+use warnings;
use RT::Test tests => 24;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/query_builder.t b/rt/t/web/query_builder.t
index 5a64d46..13cd1b5 100644
--- a/rt/t/web/query_builder.t
+++ b/rt/t/web/query_builder.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
diff --git a/rt/t/web/query_builder_queue_limits.t b/rt/t/web/query_builder_queue_limits.t
index f583d64..332cc93 100644
--- a/rt/t/web/query_builder_queue_limits.t
+++ b/rt/t/web/query_builder_queue_limits.t
@@ -78,8 +78,8 @@ ok( !$form->find_input("ValueOf'CF.{foo_cf}'"), 'no foo_cf by default' );
my $status_input = $form->find_input('ValueOfStatus');
my @statuses = sort $status_input->possible_values;
is_deeply(
- \@statuses, [ '', qw/initial new open rejected resolved stalled/], 'found all statuses'
-);
+ \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/], 'found all statuses'
+) or diag "Statuses are: ", explain \@statuses;
my $owner_input = $form->find_input('ValueOfActor');
my @owners = sort $owner_input->possible_values;
@@ -126,9 +126,9 @@ $status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
\@statuses,
- [ '', qw/initial new open rejected resolved stalled/ ],
+ [ '', qw/initial new open open rejected resolved resolved stalled/ ],
'found all statuses again'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
@@ -150,9 +150,9 @@ ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'no general_cf' );
$status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
- \@statuses, [ '', qw/initial new open rejected resolved stalled/],
+ \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/],
'found all statuses'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
@@ -173,9 +173,9 @@ $status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
\@statuses,
- [ '', qw/initial new open rejected resolved stalled/ ],
+ [ '', qw/initial new open open rejected resolved resolved stalled/ ],
'found all statuses'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
diff --git a/rt/t/web/query_log.t b/rt/t/web/query_log.t
index e19f44d..89cca2d 100644
--- a/rt/t/web/query_log.t
+++ b/rt/t/web/query_log.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/queue_caching.t b/rt/t/web/queue_caching.t
index d90aacb..d485711 100644
--- a/rt/t/web/queue_caching.t
+++ b/rt/t/web/queue_caching.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use RT::Test tests => 36;
+use RT::Test tests => 48;
# make an initial queue, so we have more than 1
my $original_test_queue = new_queue("Test$$");
@@ -31,6 +31,12 @@ diag("Bring back a disabled queue");
check_queues($m);
}
+diag("Rename the original queue, make sure the name change is uncached");
+{
+ ok($original_test_queue->SetName("Name Change $$"));
+ check_queues($m);
+}
+
diag("Test a user who has more limited rights Queues");
{
@@ -47,7 +53,7 @@ my $a_m = RT::Test::Web->new;
ok $a_m->login('user_a', 'password'), 'logged in as user A';
# check that they see a single queue
-check_queues($a_m,[$original_test_queue->Id]);
+check_queues($a_m,[$original_test_queue->Id],[$original_test_queue->Name]);
ok( RT::Test->add_rights(
{ Principal => $user_a, Right => [qw(SeeQueue CreateTicket)] },
@@ -75,16 +81,22 @@ sub internal_queues {
}
-# takes a WWW::Mech object and an optional arrayref of queue ids
-# compares the list of ids to the dropdown of Queues for the New Ticket In form
+# takes a WWW::Mech object and two optional arrayrefs of queue ids and names
+# compares the list of ids and names to the dropdown of Queues for the New Ticket In form
sub check_queues {
- my $browser = shift;
- my $queue_list = shift;
+ my ($browser, $queue_id_list, $queue_name_list) = @_;
$browser->get_ok($baseurl,"Navigated to homepage");
ok(my $form = $browser->form_name('CreateTicketInQueue'), "Found New Ticket In form");
ok(my $queuelist = $form->find_input('Queue','option'), "Found queue select");
- my @queues = $queuelist->possible_values;
- $queue_list = [keys %{internal_queues()}] unless $queue_list;
- is_deeply([sort @queues],[sort @$queue_list], "Queue list contains the expected queues");
+ my @queue_ids = $queuelist->possible_values;
+ my @queue_names = $queuelist->value_names;
+
+ my $full_queue_list = internal_queues();
+ $queue_id_list = [keys %$full_queue_list] unless $queue_id_list;
+ $queue_name_list = [values %$full_queue_list] unless $queue_name_list;
+ is_deeply([sort @queue_ids],[sort @$queue_id_list],
+ "Queue list contains the expected queue ids");
+ is_deeply([sort @queue_names],[sort @$queue_name_list],
+ "Queue list contains the expected queue namess");
}
diff --git a/rt/t/web/queue_create.t b/rt/t/web/queue_create.t
index 3d2cd04..5668762 100644
--- a/rt/t/web/queue_create.t
+++ b/rt/t/web/queue_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/quickcreate.t b/rt/t/web/quickcreate.t
index b257f9d..c49ad8c 100644
--- a/rt/t/web/quickcreate.t
+++ b/rt/t/web/quickcreate.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/quicksearch.t b/rt/t/web/quicksearch.t
index 8cc084c..922dc31 100644
--- a/rt/t/web/quicksearch.t
+++ b/rt/t/web/quicksearch.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/redirect-after-login.t b/rt/t/web/redirect-after-login.t
index 835b24c..35025a1 100644
--- a/rt/t/web/redirect-after-login.t
+++ b/rt/t/web/redirect-after-login.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/redirect.t b/rt/t/web/redirect.t
index d92386b..d909d8d 100644
--- a/rt/t/web/redirect.t
+++ b/rt/t/web/redirect.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/reminders.t b/rt/t/web/reminders.t
index 32e130c..af7e2fb 100644
--- a/rt/t/web/reminders.t
+++ b/rt/t/web/reminders.t
@@ -1,7 +1,6 @@
-#!/usr/bin/env perl
use strict;
use warnings;
-use RT::Test tests => 35;
+use RT::Test tests => 45;
my ($baseurl, $m) = RT::Test->started_ok;
@@ -27,6 +26,23 @@ $m->goto_ticket($ticket->id);
$m->form_name('UpdateReminders');
$m->field( 'NewReminder-Subject' => "baby's first reminder" );
$m->submit;
+$m->content_contains("Reminder 'baby's first reminder' added");
+
+$ticket->SetStatus('deleted');
+is( $ticket->Status, 'deleted', 'deleted ticket' );
+$m->form_name('UpdateReminders');
+$m->field( 'NewReminder-Subject' => "link to a deleted ticket" );
+$m->submit;
+$m->content_contains("Can't link to a deleted ticket");
+$m->get_ok('/Tools/MyReminders.html');
+$m->content_contains( "baby's first reminder",
+ 'got the reminder even the ticket is deleted' );
+
+$m->goto_ticket( $ticket->id );
+$m->content_lacks('New reminder:', "can't create a new reminder");
+$m->text_contains('Check box to complete', "we DO display this text when there are reminders");
+$m->content_like(qr{<th[^>]*>Reminders?</th>}, "now we have a reminder titlebar");
+$m->text_contains("baby's first reminder", "display the reminder's subject");
my $reminders = RT::Reminders->new($user);
$reminders->Ticket($ticket->id);
@@ -37,7 +53,11 @@ is($reminder->Subject, "baby's first reminder");
my $reminder_id = $reminder->id;
is($reminder->Status, 'new');
-$m->text_contains('New reminder:', 'can create a new reminder');
+$ticket->SetStatus('new');
+is( $ticket->Status, 'new', 'changed back to new' );
+
+$m->goto_ticket($ticket->id);
+$m->text_contains('New reminder:', "can create a new reminder");
$m->text_contains('Check box to complete', "we DO display this text when there are reminders");
$m->content_like(qr{<th[^>]*>Reminders?</th>}, "now we have a reminder titlebar");
$m->text_contains("baby's first reminder", "display the reminder's subject");
diff --git a/rt/t/web/requestor_groups_edit_link.t b/rt/t/web/requestor_groups_edit_link.t
index 9d1fefd..cf67311 100644
--- a/rt/t/web/requestor_groups_edit_link.t
+++ b/rt/t/web/requestor_groups_edit_link.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/requestor_groups_limit.t b/rt/t/web/requestor_groups_limit.t
index 7987a13..abc21ca 100644
--- a/rt/t/web/requestor_groups_limit.t
+++ b/rt/t/web/requestor_groups_limit.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/rest-non-ascii-subject.t b/rt/t/web/rest-non-ascii-subject.t
index d7a89af..8b870a8 100644
--- a/rt/t/web/rest-non-ascii-subject.t
+++ b/rt/t/web/rest-non-ascii-subject.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
# Test ticket creation with REST using non ascii subject
use strict;
use warnings;
diff --git a/rt/t/web/rest-sort.t b/rt/t/web/rest-sort.t
index 6b4d351..5ddaa8e 100644
--- a/rt/t/web/rest-sort.t
+++ b/rt/t/web/rest-sort.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
use RT::Test tests => 25;
diff --git a/rt/t/web/rest.t b/rt/t/web/rest.t
index e38f201..3a84b2a 100644
--- a/rt/t/web/rest.t
+++ b/rt/t/web/rest.t
@@ -1,21 +1,28 @@
-#!/usr/bin/env perl
use strict;
use warnings;
use RT::Interface::REST;
-use RT::Test tests => 22;
+use RT::Test tests => 34;
my ($baseurl, $m) = RT::Test->started_ok;
for my $name ("severity", "fu()n:k/") {
my $cf = RT::Test->load_or_create_custom_field(
Name => $name,
- Type => 'Freeform',
+ Type => 'FreeformMultiple',
Queue => 'General',
);
ok($cf->Id, "created a CustomField");
is($cf->Name, $name, "correct CF name");
}
+{
+ my $cf = RT::Test->load_or_create_custom_field(
+ Name => 'single',
+ Type => 'FreeformSingle',
+ Queue => 'General',
+ );
+ ok($cf->Id, "created a CustomField");
+}
my $queue = RT::Test->load_or_create_queue(Name => 'General');
ok($queue->Id, "loaded the General queue");
@@ -150,3 +157,171 @@ $m->post(
);
($link) = $m->content =~ m|DependedOnBy:.*ticket/(\d+)|;
is($link, 1, "Check ticket link.") or diag("'content' obtained:\n", $m->content);
+
+
+{
+ $m->post("$baseurl/REST/1.0/ticket/new", [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ ]);
+
+ my $text = $m->content;
+ my @lines = $text =~ m{.*}g;
+ shift @lines; # header
+ push @lines, "CF.{severity}: explosive";
+ push @lines, "CF.{severity}: very";
+ $text = join "\n", @lines;
+
+ $m->post("$baseurl/REST/1.0/ticket/edit", [
+ user => 'root',
+ pass => 'password',
+
+ content => $text,
+ ], Content_Type => 'form-data');
+
+ my ($id) = $m->content =~ /Ticket (\d+) created/;
+ ok($id, "got ticket #$id");
+
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ $ticket->Load($id);
+ is($ticket->Id, $id, "loaded the REST-created ticket");
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ ["explosive", "very"],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s/.*?\n\n//;
+ $text =~ s/\n\n/\n/;
+ $text =~ s{CF\.{severity}:.*\n}{}img;
+ $text .= "CF.{severity}: explosive, a bit\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ ['a bit', 'explosive'],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s{CF\.{severity}:.*\n}{}img;
+ $text .= "CF.{severity}:\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ [],
+ "CF successfully set"
+ );
+
+ my @txns = map [$_->OldValue, $_->NewValue], grep $_->Type eq 'CustomField',
+ @{ $ticket->Transactions->ItemsArrayRef };
+ is_deeply(\@txns, [['very', undef], [undef, 'a bit'], ['explosive', undef], ['a bit', undef]]);
+}
+
+{
+ $m->post("$baseurl/REST/1.0/ticket/new", [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ ]);
+
+ my $text = $m->content;
+ my @lines = $text =~ m{.*}g;
+ shift @lines; # header
+ push @lines, "CF.{single}: this";
+ $text = join "\n", @lines;
+
+ $m->post("$baseurl/REST/1.0/ticket/edit", [
+ user => 'root',
+ pass => 'password',
+
+ content => $text,
+ ], Content_Type => 'form-data');
+
+ my ($id) = $m->content =~ /Ticket (\d+) created/;
+ ok($id, "got ticket #$id");
+
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ $ticket->Load($id);
+ is($ticket->Id, $id, "loaded the REST-created ticket");
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("single")->ItemsArrayRef }],
+ ["this"],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s{CF\.{single}:.*\n}{}img;
+ $text .= "CF.{single}: that\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("single")->ItemsArrayRef }],
+ ['that'],
+ "CF successfully set"
+ );
+
+ my @txns = map [$_->OldValue, $_->NewValue], grep $_->Type eq 'CustomField',
+ @{ $ticket->Transactions->ItemsArrayRef };
+ is_deeply(\@txns, [['this', 'that']]);
+}
diff --git a/rt/t/web/richtext-autohandler.t b/rt/t/web/richtext-autohandler.t
index 734426f..724a7b3 100644
--- a/rt/t/web/richtext-autohandler.t
+++ b/rt/t/web/richtext-autohandler.t
@@ -1,4 +1,5 @@
use strict;
+use warnings;
use RT::Test tests => 9;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/rights.t b/rt/t/web/rights.t
index 9a5f358..23b357f 100644
--- a/rt/t/web/rights.t
+++ b/rt/t/web/rights.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/rights1.t b/rt/t/web/rights1.t
index 24e5c34..63ddb38 100644
--- a/rt/t/web/rights1.t
+++ b/rt/t/web/rights1.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use HTTP::Cookies;
use RT::Test nodata => 1, tests => 31;
diff --git a/rt/t/web/saved_search_chart.t b/rt/t/web/saved_search_chart.t
index f843071..70111b9 100644
--- a/rt/t/web/saved_search_chart.t
+++ b/rt/t/web/saved_search_chart.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_context.t b/rt/t/web/saved_search_context.t
index fe9c51e..0c37a6a 100644
--- a/rt/t/web/saved_search_context.t
+++ b/rt/t/web/saved_search_context.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_permissions.t b/rt/t/web/saved_search_permissions.t
index 5cae30b..f61c931 100644
--- a/rt/t/web/saved_search_permissions.t
+++ b/rt/t/web/saved_search_permissions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_update.t b/rt/t/web/saved_search_update.t
index dfb18d4..f06f70f 100644
--- a/rt/t/web/saved_search_update.t
+++ b/rt/t/web/saved_search_update.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/scrips.t b/rt/t/web/scrips.t
index def20ec..0ff46bf 100644
--- a/rt/t/web/scrips.t
+++ b/rt/t/web/scrips.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/scrub.t b/rt/t/web/scrub.t
index 612c6e2..835f412 100644
--- a/rt/t/web/scrub.t
+++ b/rt/t/web/scrub.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/search_bulk_update_links.t b/rt/t/web/search_bulk_update_links.t
index 7d150a6..ffe2efe 100644
--- a/rt/t/web/search_bulk_update_links.t
+++ b/rt/t/web/search_bulk_update_links.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/search_rss.t b/rt/t/web/search_rss.t
index 95de931..9a53a8d 100644
--- a/rt/t/web/search_rss.t
+++ b/rt/t/web/search_rss.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use RT::Test tests => 38;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/search_tabs.t b/rt/t/web/search_tabs.t
index b3ed2cb..b679eaf 100644
--- a/rt/t/web/search_tabs.t
+++ b/rt/t/web/search_tabs.t
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
-use warnings;
use strict;
+use warnings;
+
use RT::Test tests => 21;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/template.t b/rt/t/web/template.t
index 40a5366..4a2e6c1 100644
--- a/rt/t/web/template.t
+++ b/rt/t/web/template.t
@@ -1,8 +1,7 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 19;
+use RT::Test tests => 22;
my $user_a = RT::Test->load_or_create_user(
Name => 'user_a', Password => 'password',
@@ -60,3 +59,35 @@ $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
$m->form_name('ModifyTemplate');
is($m->value('Type'), 'Perl', 'now that we have ExecuteCode we can update Type to Perl');
+{ # 21152: Each time you save a Template a newline is chopped off the front
+ $m->form_name('ModifyTemplate');
+ my $content;
+
+
+ TODO: {
+
+ local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
+ # this test fails because earlier tests add newlines when using Mech
+ like($content = $m->value('Content'), qr/^Subject: Resolved/, 'got expected Content');
+
+ }
+
+ $content = "\n\n\n" . $content;
+ $m->field(Content => $content);
+ $m->submit;
+
+ $m->content_contains('Template Resolved: Content updated');
+
+ # next submit should not result in an update
+ $m->form_name('ModifyTemplate');
+ $m->submit;
+
+ TODO: {
+
+ local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
+ # this test fails because the template change makes Mech continuously add newlines where browsers dont
+ $m->content_lacks('Template Resolved: Content updated');
+
+ }
+}
+
diff --git a/rt/t/web/ticket-create-utf8.t b/rt/t/web/ticket-create-utf8.t
index 8d36bd1..bebc57b 100644
--- a/rt/t/web/ticket-create-utf8.t
+++ b/rt/t/web/ticket-create-utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_display.t b/rt/t/web/ticket_display.t
index a9cab0c..35e9217 100644
--- a/rt/t/web/ticket_display.t
+++ b/rt/t/web/ticket_display.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 18;
+use RT::Test tests => undef;
my $queue = RT::Test->load_or_create_queue( Name => 'General' );
@@ -10,10 +10,15 @@ my $user = RT::Test->load_or_create_user(
Password => 'password',
);
+my $cf = RT::Test->load_or_create_custom_field( Name => 'test_cf', Queue => $queue->Name, Type => 'FreeformSingle' );
+my $cf_form_id = 'Object-RT::Ticket--CustomField-'.$cf->Id.'-Value';
+my $cf_test_value = "some string for test_cf $$";
+
my ( $baseurl, $m ) = RT::Test->started_ok;
ok(
RT::Test->set_rights(
{ Principal => $user, Right => [qw(SeeQueue CreateTicket)] },
+ { Principal => $user, Object => $queue, Right => [qw(SeeCustomField ModifyCustomField)] }
),
'set rights'
);
@@ -26,7 +31,7 @@ diag "test ShowTicket right";
$m->get_ok( '/Ticket/Create.html?Queue=' . $queue->id,
'go to ticket create page' );
my $form = $m->form_name('TicketCreate');
- $m->submit_form( fields => { Subject => 'ticket foo' } );
+ $m->submit_form( fields => { Subject => 'ticket foo', $cf_form_id => $cf_test_value } );
my $ticket = RT::Test->last_ticket;
ok( $ticket->id, 'ticket is created' );
@@ -56,8 +61,9 @@ diag "test ShowTicket right";
$m->content_lacks( "No permission to view ticket", 'no error msg' );
$m->title_is( "#$id: ticket foo", 'we can it' );
+ $m->content_contains($cf_test_value, "Custom Field was submitted and saved");
}
-# TODO more /Ticket/Display.html tests here
-
+undef $m;
+done_testing();
diff --git a/rt/t/web/ticket_forward.t b/rt/t/web/ticket_forward.t
index 0c411b9..adf4d6f 100644
--- a/rt/t/web/ticket_forward.t
+++ b/rt/t/web/ticket_forward.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_modify_all.t b/rt/t/web/ticket_modify_all.t
index 2f0c4d1..6d19b28 100644
--- a/rt/t/web/ticket_modify_all.t
+++ b/rt/t/web/ticket_modify_all.t
@@ -68,7 +68,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
$m->field(WatcherAddressEmail => 'root@localhost');
$m->click('SubmitTicket');
$m->text_contains(
- "Added principal as a Requestor for this ticket",
+ "Added root as a Requestor for this ticket",
'watcher is added',
);
$m->form_name('TicketModifyAll');
@@ -76,7 +76,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
$m->field(WatcherAddressEmail => 'root@localhost');
$m->click('SubmitTicket');
$m->text_contains(
- "That principal is already a Requestor for this ticket",
+ "root is already a Requestor for this ticket",
'no duplicate watchers',
);
diff --git a/rt/t/web/ticket_owner.t b/rt/t/web/ticket_owner.t
index 4db39e6..8150853 100644
--- a/rt/t/web/ticket_owner.t
+++ b/rt/t/web/ticket_owner.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_owner_autocomplete.t b/rt/t/web/ticket_owner_autocomplete.t
index 3aa3f28..040aa73 100644
--- a/rt/t/web/ticket_owner_autocomplete.t
+++ b/rt/t/web/ticket_owner_autocomplete.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_owner_issues_16656.t b/rt/t/web/ticket_owner_issues_16656.t
index a6306f7..c9fc783 100644
--- a/rt/t/web/ticket_owner_issues_16656.t
+++ b/rt/t/web/ticket_owner_issues_16656.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_seen.t b/rt/t/web/ticket_seen.t
index 8dacaf5..e40782f 100644
--- a/rt/t/web/ticket_seen.t
+++ b/rt/t/web/ticket_seen.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_txn_content.t b/rt/t/web/ticket_txn_content.t
index db47512..c0cae97 100644
--- a/rt/t/web/ticket_txn_content.t
+++ b/rt/t/web/ticket_txn_content.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 63;
my $plain_file = File::Spec->catfile( RT::Test->temp_directory, 'attachment.txt' );
diff --git a/rt/t/web/ticket_update_without_content.t b/rt/t/web/ticket_update_without_content.t
index 54f0c5a..b4247ab 100644
--- a/rt/t/web/ticket_update_without_content.t
+++ b/rt/t/web/ticket_update_without_content.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/unlimited_search.t b/rt/t/web/unlimited_search.t
index 988a291..6a5f697 100644
--- a/rt/t/web/unlimited_search.t
+++ b/rt/t/web/unlimited_search.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use RT::Test tests => 85;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/user_update.t b/rt/t/web/user_update.t
index dc908fc..f55c773 100644
--- a/rt/t/web/user_update.t
+++ b/rt/t/web/user_update.t
@@ -1,32 +1,43 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
-use RT::Test tests => 9;
+use RT::Test tests => undef;
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login(), 'logged in' );
$m->follow_link_ok({text => 'About me'});
-$m->form_with_fields('Lang');
-$m->field(Lang => 'ja');
-$m->submit;
-
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+ "Change to Japanese");
$m->text_contains("Lang changed from (no value) to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
# we only changed one field, and it wasn't the default, so this feedback is
# spurious and annoying
$m->content_lacks("That is already the current value");
# change back to English
-$m->form_with_fields('Lang');
-$m->field(Lang => 'en_us');
-$m->submit;
+$m->submit_form_ok({ with_fields => { Lang => 'en_us'} },
+ "Change back to english");
# This message shows up in Japanese
# $m->text_contains("Lang changed from 'ja' to 'en_us'");
$m->text_contains("Langは「'ja'」から「'en_us'」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
-# another spurious update
+# Check for a lack of spurious updates
$m->content_lacks("That is already the current value");
+# Ensure that we can change the language back to the default.
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+ "Back briefly to Japanese");
+$m->text_contains("Lang changed from 'en_us' to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
+$m->submit_form_ok({ with_fields => { Lang => ''} },
+ "And set to the default");
+$m->text_contains("Langは「'ja'」から「''」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
+
+undef $m;
+
+done_testing;
diff --git a/rt/t/web/walk.t b/rt/t/web/walk.t
index 34fab14..97aa36e 100644
--- a/rt/t/web/walk.t
+++ b/rt/t/web/walk.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;