diff options
Diffstat (limited to 'rt/t/web')
83 files changed, 434 insertions, 134 deletions
diff --git a/rt/t/web/admin_groups.t b/rt/t/web/admin_groups.t index 783b5ad44..075fb6282 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 fde075f4d..36b9af1b4 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 bfbf24590..5af7fda20 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 784cbbe88..b518ec176 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 31e28c406..e61e80e9c 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 f984bf3e4..f9c61b519 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 73b7765c1..675fa2177 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 887aa4220..4ea93e4de 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 9781c5e2e..8cc099d1c 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 422eeff60..bd6ae66aa 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 15fe416b4..92fcf53f3 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 cec41a8aa..2d9ad035d 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 dde82952b..e3f7f446a 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 394daaba9..7c444f49d 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 d63956be3..6afad8a85 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 1f82ab91f..0ae6ead5b 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 361506c10..69bf80c69 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 b30edc3d8..1743a3a8e 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 5bb908165..d909c4a8d 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 d99b4ce22..24aae40a1 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 43c5f6e33..ee5e9f58a 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 f8fde2500..bf7d659cd 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 1d56da5be..edb706810 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 4cd7fea1f..cb96acaf0 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 ac2a5aca0..db2fccf1c 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 f2e59e5cc..433fdd373 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 ad2a96969..517e26ee6 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 88b3ab9c2..03e60901e 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 cf27e48a7..893ae65c9 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 4842dcd54..1509d1df3 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 944539758..eb4388a2c 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 f4c8fa4b6..a5f834eee 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 26da59268..548970d2d 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 662a26bbd..78b95a3b2 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 4dc82df47..a34cdcb4b 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 889e5fc18..73ff25c33 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 b3762fc20..06d51913a 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 bf9cf39fa..4518c7b7a 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 24795c0d3..c317a4616 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 2664c5bc2..d41decfd2 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 3d9bf0129..41b0196b4 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 ceb2b34af..3ece854a7 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 5a64d4646..13cd1b5d0 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 f583d64cc..332cc939c 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 e19f44dc6..89cca2d7b 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 d90aacbdf..d4857115e 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 3d2cd04d0..566876231 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 b257f9ddd..c49ad8c85 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 8cc084ce5..922dc318f 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 835b24c37..35025a1e1 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 d92386bb8..d909d8d43 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 32e130c47..af7e2fb26 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 9d1fefd5c..cf67311eb 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 7987a136c..abc21cad7 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 d7a89af5e..8b870a8b1 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 6b4d35169..5ddaa8ec5 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 e38f201fb..3a84b2a01 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 734426fc3..724a7b34c 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 9a5f358e2..23b357f79 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 24e5c3448..63ddb38c4 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 f84307162..70111b97c 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 fe9c51ead..0c37a6a3a 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 5cae30b28..f61c931a0 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 dfb18d49c..f06f70fb6 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 def20eca7..0ff46bf26 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 612c6e210..835f41226 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 7d150a699..ffe2efe81 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 95de931c3..9a53a8d94 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 b3ed2cbdf..b679eafca 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 40a5366dc..4a2e6c13a 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 8d36bd19e..bebc57b51 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 a9cab0cbf..35e921732 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 0c411b99f..adf4d6f69 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 2f0c4d1b3..6d19b28e4 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 4db39e61a..81508534a 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 3aa3f282f..040aa7323 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 a6306f740..c9fc7830e 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 8dacaf59f..e40782f6a 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 db4751218..c0cae976c 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 54f0c5a8a..b4247abe3 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 988a2918d..6a5f69724 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 dc908fc10..f55c773cd 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 34fab1476..97aa36e12 100644 --- a/rt/t/web/walk.t +++ b/rt/t/web/walk.t @@ -1,4 +1,3 @@ -#!/usr/bin/perl use strict; use warnings; |