[Rt-commit] rt branch, 3.999-trunk, updated. 31213e386712d60727683f0d21db43b81c159c98

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Nov 24 03:06:59 EST 2009


The branch, 3.999-trunk has been updated
       via  31213e386712d60727683f0d21db43b81c159c98 (commit)
       via  69657b3a1f46d0af58a31d9b5646a8cac8ece104 (commit)
       via  7835180d755dae92831e2033a75d4e221747e45a (commit)
       via  e1b1580ed795c0a06c2c13afaef0a353a0de034a (commit)
       via  3c2f289cb007ae51d28d4738ae29a5e9072a4f27 (commit)
       via  f8edc45a9b28ff21190803519d0a191d2e0f76d0 (commit)
       via  eabfc4428cf1374afbf5f13e4a9b3e83a5b719e9 (commit)
      from  784e4c0a54fb8893e2958fcc694ec276aa1ad2b1 (commit)

Summary of changes:
 lib/RT/Dispatcher.pm             |   33 ++++++++++++------
 lib/RT/Test/Web.pm               |    4 +--
 share/html/Elements/Header       |   10 +++--
 share/html/Elements/SimpleSearch |    2 +-
 share/web/static/css/layout.css  |   66 ++++++-------------------------------
 t/mail/gnupg-bad.t               |    2 +-
 t/mail/gnupg-incoming.t          |    2 +-
 t/mail/gnupg-realmail.t          |    2 +-
 t/web/attachments.t              |    5 +--
 t/web/cf_access.t                |   18 ++--------
 t/web/cf_select_one.t            |    4 +-
 t/web/gnupg-outgoing.t           |   28 ++++++++-------
 t/web/ticket_owner.t             |    8 +---
 13 files changed, 68 insertions(+), 116 deletions(-)

- Log -----------------------------------------------------------------
commit 7835180d755dae92831e2033a75d4e221747e45a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 14:17:33 2009 +0800

    fix tests, as the change to quick create

diff --git a/t/mail/gnupg-bad.t b/t/mail/gnupg-bad.t
index 94ccbdc..b706a4f 100644
--- a/t/mail/gnupg-bad.t
+++ b/t/mail/gnupg-bad.t
@@ -42,7 +42,7 @@ $m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 2,
+$m->submit_form( form_number => 3,
          fields      => { correspond_address => 'rt at example.com' } );
 $m->content_like(qr/rt\@example.com.* - never/, 'has key info.');
 ok(my $user = RT::Model::User->new(current_user => RT->system_user));
diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index 3c030e2..f107ce2 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -47,8 +47,8 @@ my ($baseurl, $m) = RT::Test->started_ok;
 $m->login();
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
-$m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 2,
+$m->follow_link_ok( text => 'General', url_regex => qr!/Admin/Queues! );
+$m->submit_form( form_number => 3,
 		 fields      => { correspond_address => 'general at example.com' } );
 $m->content_like(qr/general\@example.com.* - never/, 'has key info.');
 
diff --git a/t/mail/gnupg-realmail.t b/t/mail/gnupg-realmail.t
index 42d8dd0..6ad0a95 100644
--- a/t/mail/gnupg-realmail.t
+++ b/t/mail/gnupg-realmail.t
@@ -44,8 +44,8 @@ RT::Test->trust_gnupg_key('rt-test at example.com');
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'we did log in';
 $m->get_ok( '/Admin/Queues/');
-$m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 2,
+$m->follow_link_ok( text => 'General', url_regex => qr!/Admin/Queues! );
+$m->submit_form( form_number => 3,
          fields      => { correspond_address => 'rt-recipient at example.com' } );
 $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.');
 
diff --git a/t/web/attachments.t b/t/web/attachments.t
index 6dfdc5b..fe283ed 100644
--- a/t/web/attachments.t
+++ b/t/web/attachments.t
@@ -13,10 +13,7 @@ my $queue = RT::Model::Queue->new(current_user => RT->nobody);
 my $qid = $queue->load('General');
 ok( $qid, "Loaded General queue" );
 
-$m->form_name('create_ticket_in_queue');
-$m->field('queue', $qid);
-$m->submit;
-is($m->status, 200, "request successful");
+$m->follow_link_ok( url_regex => qr'/ticket/create', text => 'General');
 $m->content_like(qr/Create a new ticket/, 'ticket create page');
 $m->fill_in_action_ok('create_ticket', (
     subject     => 'Attachments test',
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index 7350192..7c66dda 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -38,7 +38,7 @@ my ( $cf, $cfid, $tid );
     $m->title_is(q/Created CustomField img/, 'admin-cf Created');
     $m->follow_link( text => 'Queues' );
     $m->title_is(q/Admin queues/, 'admin-queues screen');
-    $m->follow_link( text => 'General' );
+    $m->follow_link( text => 'General', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Editing Configuration for queue General/, 'admin-queue: general');
     $m->follow_link( text => 'Ticket Custom Fields' );
 
@@ -73,8 +73,7 @@ diag "check that we have no the CF on the create"
     ." ticket page when user has no SeeCustomField right"
         if $ENV{'TEST_VERBOSE'};
 {
-    $m->follow_link( url_regex => qr'/ticket/create/', text => 'General');
-    $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
+    $m->follow_link_ok( url_regex => qr'/ticket/create', text => 'General');
 
     my $form = $m->form_name("ticket_create");
 
@@ -101,7 +100,7 @@ diag "check that we have no the CF on the create"
     ." ticket page when user has no ModifyCustomField right"
         if $ENV{'TEST_VERBOSE'};
 {
-    $m->follow_link( url_regex => qr'/ticket/create/', text => 'General');
+    $m->follow_link( url_regex => qr'/ticket/create', text => 'General');
     $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
 
     my $form = $m->form_name("ticket_create");
@@ -128,7 +127,7 @@ RT::Test->set_rights(
 
 diag "create a ticket with an image" if $ENV{'TEST_VERBOSE'};
 {
-    $m->follow_link( url_regex => qr'/ticket/create/', text => 'General');
+    $m->follow_link( url_regex => qr'/ticket/create', text => 'General');
     TODO: {
         local $TODO = "Multi-upload CFs not available yet";
         $m->content_like(qr/Upload multiple images/, 'has a upload image field');
diff --git a/t/web/cf_onqueue.t b/t/web/cf_onqueue.t
index f79ecfa..e12c759 100644
--- a/t/web/cf_onqueue.t
+++ b/t/web/cf_onqueue.t
@@ -51,7 +51,7 @@ diag "Edit the CF value for default queue" if $ENV{'TEST_VERBOSE'};
     $m->title_is(q/Editing Configuration for queue General/, 'default queue configuration screen');
     $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on default queue' );
     $m->submit_form(
-        form_number => 2,
+        form_number => 3,
         # The following doesn't want to works :(
         #with_fields => { 'object-RT::Model::Queue-1-CustomField-1-value' },
         fields => {
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index d642593..42b4b05 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -52,9 +52,9 @@ ok $queue && $queue->id, 'loaded or Created queue';
 
 diag "apply the CF to General queue" if $ENV{'TEST_VERBOSE'};
 {
-    $m->follow_link( text => 'Queues' );
+    $m->follow_link( text => 'Queues', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Admin queues/, 'admin-queues screen');
-    $m->follow_link( text => 'General' );
+    $m->follow_link( text => 'General', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Editing Configuration for queue General/, 'admin-queue: general');
     $m->follow_link( text => 'Ticket Custom Fields' );
     $m->title_is(q/Edit Custom Fields for General/, 'admin-queue: general cfid');
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index 759775c..d14094c 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -57,7 +57,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( sign => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -84,7 +84,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -98,7 +98,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -119,7 +119,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -133,7 +133,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -166,7 +166,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -180,7 +180,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -212,7 +212,7 @@ diag "check that we see key selector even if only one key is trusted but there a
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -226,7 +226,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -240,7 +240,7 @@ diag "check that key selector works and we can select trusted key"
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -254,7 +254,7 @@ diag "check that key selector works and we can select trusted key"
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -272,7 +272,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -287,7 +287,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index e28f766..df115cd 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -69,7 +69,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( sign => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -97,7 +97,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -111,7 +111,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -134,7 +134,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -148,7 +148,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -182,7 +182,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -196,7 +196,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -228,7 +228,7 @@ diag "check that we see key selector even if only one key is trusted but there a
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -242,7 +242,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -256,7 +256,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -270,7 +270,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -289,7 +289,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_name('ticket_update');
+    $m->form_number(3);
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -304,7 +304,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_update');
+    my $form = $m->form_number(3);
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 67e0627..38ff64d 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -146,7 +146,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
 {
     my $response = $agent->get($url."/Search/Edit.html");
     ok( $response->is_success, "Fetched /Search/Edit.html" );
-    ok($agent->form_number(2), "found the form");
+    ok($agent->form_number(3), "found the form");
     $agent->field("query", "Status = 'new' OR ( Status = 'open' AND subject LIKE 'office' )");
     $agent->submit;
     is( get_query_from_form,
@@ -234,7 +234,7 @@ diag "input a condition, select (several conditions), click delete"
 {
     my $response = $agent->get( $url."/Search/Edit.html" );
     ok $response->is_success, "Fetched /Search/Edit.html";
-    ok $agent->form_number(2), "found the form";
+    ok $agent->form_number(3), "found the form";
     $agent->field("query", "( Status = 'new' OR Status = 'open' )");
     $agent->submit;
     is( get_query_from_form,
diff --git a/t/web/rights.t b/t/web/rights.t
index 6a0d961..2645c08 100644
--- a/t/web/rights.t
+++ b/t/web/rights.t
@@ -16,7 +16,7 @@ sub get_rights {
     my $agent = shift;
     my $principal_id = shift;
     my $object = shift;
-    $agent->form_number(2);
+    $agent->form_number(3);
     my @inputs = $agent->current_form->find_input("revoke_right-$principal_id-$object");
     my @Rights = sort grep $_, map $_->possible_values, grep $_, @inputs;
     return @Rights;
@@ -33,7 +33,7 @@ my ($everyone, $everyone_gid);
 diag "revoke all global rights from Everyone group" if $ENV{'TEST_VERBOSE'};
 my @has = get_rights( $m, $everyone_gid, 'RT::System-1' );
 if ( @has ) {
-    $m->form_number(2);
+    $m->form_number(3);
     $m->tick("revoke_right-$everyone_gid-RT::System-1", $_) foreach @has;
     $m->submit;
     
@@ -44,7 +44,7 @@ if ( @has ) {
 
 diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(2);
+    $m->form_number(3);
     $m->select("grant_right-$everyone_gid-RT::System-1", ['SuperUser']);
     $m->submit;
 
@@ -56,7 +56,7 @@ diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 
 diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(2);
+    $m->form_number(3);
     $m->tick("revoke_right-$everyone_gid-RT::System-1", 'SuperUser');
     $m->submit;
 
@@ -69,7 +69,7 @@ diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 
 diag "return rights the group had in the beginning" if $ENV{'TEST_VERBOSE'};
 if ( @has ) {
-    $m->form_number(2);
+    $m->form_number(3);
     $m->select("grant_right-$everyone_gid-RT::System-1", \@has);
     $m->submit;
 
diff --git a/t/web/ticket_owner.t b/t/web/ticket_owner.t
index d7884b9..aeaea37 100644
--- a/t/web/ticket_owner.t
+++ b/t/web/ticket_owner.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Test strict => 0, tests => 94, l10n => 1;
+use RT::Test strict => 0, tests => 93, l10n => 1;
 
 
 my $queue = RT::Test->load_or_create_queue( name => 'Regression' );
@@ -32,7 +32,7 @@ ok $agent_a->login('user_a', 'password'), 'logged in as user A';
 diag "current user has no right to own, nobody selected as owner on create" if $ENV{TEST_VERBOSE};
 {
     $agent_a->get_ok('/', 'open home page');
-    $agent_a->follow_link_ok( url_regex => qr'ticket/create' , text => $queue->name);
+    $agent_a->follow_link( url_regex => qr'/ticket/create', text => 'General');
 
     $agent_a->content_like(qr/Create a new ticket/i, 'opened create ticket page');
     my $form = $agent_a->form_name('ticket_create');
@@ -54,7 +54,8 @@ diag "current user has no right to own, nobody selected as owner on create" if $
 
 diag "user can chose owner of a new ticket" if $ENV{TEST_VERBOSE};
 {
-    $agent_a->follow_link_ok( url_regex => qr'ticket/create' , text => $queue->name);
+    $agent_a->get_ok('/', 'open home page');
+    $agent_a->follow_link( url_regex => qr'/ticket/create', text => 'General');
 
     $agent_a->content_like(qr/Create a new ticket/i, 'opened create ticket page');
     my $moniker = $agent_a->moniker_for('RT::Action::CreateTicket');
@@ -97,7 +98,7 @@ diag "user A can not change owner after create" if $ENV{TEST_VERBOSE};
         $agent->goto_ticket( $id );
         diag("Going to ticket $id") if $ENV{TEST_VERBOSE};
         $agent->follow_link_ok(text => 'Basics');
-        my $form = $agent->form_number(2);
+        my $form = $agent->form_number(3);
         is $agent->action_field_value(
             $agent->moniker_for('RT::Action::UpdateTicket'), 'owner'
           ),
@@ -137,7 +138,7 @@ diag "on reply correct owner is selected" if $ENV{TEST_VERBOSE};
     $agent_a->goto_ticket( $id );
     $agent_a->follow_link_ok(text => 'Reply');
 
-    my $form = $agent_a->form_number(2);
+    my $form = $agent_a->form_number(3);
     is $form->value('owner'), '', 'empty value selected';
     $agent_a->submit;
 

commit 69657b3a1f46d0af58a31d9b5646a8cac8ece104
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 14:49:59 2009 +0800

    merge and resolve from 3.999-trunk

diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index d177d04..bcf84f3 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -147,11 +147,22 @@ sub validate_gnupg {
         if ( $value->{enable} ) {
             my $gpgopts = $self->argument_value('gnupg_options')
               || RT->config->get('gnupg_options') || {};
-            unless ( -d $gpgopts->{homedir} && -r _ ) {    # no homedir, no gpg
+
+            # no homedir, no gpg
+            my $homedir = $gpgopts->{homedir};
+            unless ( -d $homedir ) {
+                return $self->validation_error(
+                    gnupg => _(
+'your configured GnuPG home directory does not exist: "%1"',
+                        $homedir
+                      )
+                );
+            }
+            unless ( -r $homedir ) {
                 return $self->validation_error(
                     gnupg => _(
-"couldn't successfully read your configured GnuPG home directory: '%1'",
-                        $gpgopts->{homedir}
+'could not read your configured GnuPG home directory: "%1"',
+                        $homedir
                       )
                 );
             }
diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index a36d94f..5cf4c92 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -54,6 +54,7 @@ sub after_set_queue {
 
     $self->set_valid_statuses($queue);
     $self->set_valid_owners($queue);
+    $self->setup_gnupg($queue);
 
     $self->add_role_group_parameter(
         name          => 'requestors',
@@ -175,6 +176,23 @@ sub set_valid_owners {
     $self->fill_parameter(owner => valid_values => [ map { $_->id } @valid_owners ]);
 }
 
+sub setup_gnupg {
+    my $self  = shift;
+    my $queue = shift;
+
+    return unless RT->config->get('gnupg')->{enable};
+
+    $self->fill_parameter(sign => (
+        render_as => 'checkbox',
+        default   => $queue->sign,
+    ));
+
+    $self->fill_parameter(encrypt => (
+        render_as => 'checkbox',
+        default   => $queue->encrypt,
+    ));
+}
+
 sub set_initial_priority {
     my $self  = shift;
     my $queue = shift;
diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 57be552..c3e6d7f 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -757,6 +757,18 @@ before qr{^/Search/Build.html} => run {
 
 };
 
+on '/ticket/create' => run {
+    my $action = Jifty->web->request->action('create_ticket');
+    my $queue = $action ? $action->argument('queue') : get('queue');
+    if (!defined($queue)) {
+        show '/ticket/select-queue-for-create';
+    }
+    else {
+        set(queue => $queue);
+        show '/ticket/create';
+    }
+};
+
 # Backward compatibility with old RT URLs
 
 before '/NoAuth/Logout.html' => run { redirect '/logout' };
diff --git a/lib/RT/Model/QueueCollection.pm b/lib/RT/Model/QueueCollection.pm
index 7a32849..b24dcb0 100755
--- a/lib/RT/Model/QueueCollection.pm
+++ b/lib/RT/Model/QueueCollection.pm
@@ -131,6 +131,5 @@ sub add_record {
     $self->SUPER::add_record($Queue);
 }
 
-
 1;
 
diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 9e5caa2..4a9813d 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -756,7 +756,7 @@ sub create {
     # //RUZ
 
     foreach my $type ( keys %LINKTYPEMAP ) {
-        next unless ( defined $args{$type} );
+        next unless $args{$type};
         foreach my $link ( ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) ) {
 
             # Check rights on the other end of the link if we must
diff --git a/lib/RT/View/Ticket/Create.pm b/lib/RT/View/Ticket/Create.pm
index bcbdd3f..708fe6b 100644
--- a/lib/RT/View/Ticket/Create.pm
+++ b/lib/RT/View/Ticket/Create.pm
@@ -54,16 +54,7 @@ use Jifty::View::Declare -base;
 __PACKAGE__->use_mason_wrapper;
 
 template 'create' => page { title => _('Create a new ticket') } content {
-    # If we have a create_ticket action, pluck the queue out, otherwise,
-    # check the regular queue query parameter
-    my $action = Jifty->web->request->action('create_ticket');
-    my $queue = $action ? $action->argument('queue') : get('queue');
-    $queue or die "Queue not specified";
-
-    render_mason('/Elements/Tabs', {
-        current_toptab => 'ticket/create',
-        title          => _("Create a new ticket"),
-    });
+    my $queue = get('queue');
 
     my $create = new_action(
         class   => 'CreateTicket',
@@ -79,5 +70,27 @@ template 'create' => page { title => _('Create a new ticket') } content {
     };
 };
 
+template 'select-queue-for-create' =>
+page { title => _('Create a new ticket') }
+content {
+    my $queues = RT::Model::QueueCollection->new;
+    $queues->unlimit;
+
+    p { _("Please select a queue for your new ticket.") };
+    ul {
+        while (my $queue = $queues->next) {
+            li {
+                hyperlink(
+                    label => $queue->name,
+                    url => '/ticket/create',
+                    parameters => {
+                        queue => $queue->id,
+                    },
+                );
+            }
+        }
+    }
+};
+
 1;
 
diff --git a/share/html/Admin/Global/GroupRights.html b/share/html/Admin/Global/GroupRights.html
index e72f4ba..4672c26 100755
--- a/share/html/Admin/Global/GroupRights.html
+++ b/share/html/Admin/Global/GroupRights.html
@@ -51,7 +51,7 @@
     title => _('Modify global group rights') &>  
 <& /Elements/ListActions, actions => \@results &>
 
-  <form method="post" action="GroupRights.html">
+  <form method="post" action="GroupRights.html" name="group_rights_modify">
       
 <&| /Widgets/TitleBox, title => _('Modify global group rights.')&>
       
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index 2824db0..2f97389 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -54,7 +54,7 @@
 
 
 
-<form action="<%RT->config->get('web_path')%>/Admin/Queues/Modify.html" method="post">
+<form action="<%RT->config->get('web_path')%>/Admin/Queues/Modify.html" method="post" name="queue_modify">
 <input type="hidden" class="hidden" name="set_enabled" value="1" />
 <input type="hidden" class="hidden" name="id" value="<% $create? 'new': $queue_obj->id %>" />
 
diff --git a/share/html/Search/Edit.html b/share/html/Search/Edit.html
index 9a50fe6..bded257 100755
--- a/share/html/Search/Edit.html
+++ b/share/html/Search/Edit.html
@@ -59,7 +59,7 @@
 
 <& Elements/NewListActions, actions => \@actions &>
 
-<form method="post" action="Build.html">
+<form method="post" action="Build.html" name="query_edit">
 <input type="hidden" class="hidden" name="saved_search_id" value="<% $saved_search_id %>" />
 <&|/Widgets/TitleBox, title => _('Query'), &>
 <textarea name="query" rows="8" cols="72"><% $query %></textarea>
diff --git a/share/html/Ticket/Modify.html b/share/html/Ticket/Modify.html
index 2f48630..577b492 100755
--- a/share/html/Ticket/Modify.html
+++ b/share/html/Ticket/Modify.html
@@ -53,7 +53,7 @@
 % $m->callback(callback_name => 'BeforeActionList', actions => \@results, args_ref => \%ARGS, ticket => $ticket_obj);
 
 <& /Elements/ListActions, actions => \@results &>
-<% Jifty->web->form->start( submit_to => '?id=' . $ticket_obj->id ) %>
+<% Jifty->web->form->start( name => 'ticket_modify', submit_to => '?id=' . $ticket_obj->id ) %>
 % $m->callback( callback_name => 'FormStart', args_ref => \%ARGS );
 <input type="hidden" class="hidden" name="id" value="<% $ticket_obj->id %>" />
 
diff --git a/t/mail/gnupg-bad.t b/t/mail/gnupg-bad.t
index b706a4f..1f2b537 100644
--- a/t/mail/gnupg-bad.t
+++ b/t/mail/gnupg-bad.t
@@ -42,7 +42,7 @@ $m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'ticket_create',
          fields      => { correspond_address => 'rt at example.com' } );
 $m->content_like(qr/rt\@example.com.* - never/, 'has key info.');
 ok(my $user = RT::Model::User->new(current_user => RT->system_user));
diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index f107ce2..035e63b 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -48,7 +48,7 @@ $m->login();
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( text => 'General', url_regex => qr!/Admin/Queues! );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'queue_modify',
 		 fields      => { correspond_address => 'general at example.com' } );
 $m->content_like(qr/general\@example.com.* - never/, 'has key info.');
 
diff --git a/t/mail/gnupg-realmail.t b/t/mail/gnupg-realmail.t
index 6ad0a95..a454f9c 100644
--- a/t/mail/gnupg-realmail.t
+++ b/t/mail/gnupg-realmail.t
@@ -45,7 +45,7 @@ my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'we did log in';
 $m->get_ok( '/Admin/Queues/');
 $m->follow_link_ok( text => 'General', url_regex => qr!/Admin/Queues! );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'queue_modify',
          fields      => { correspond_address => 'rt-recipient at example.com' } );
 $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.');
 
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index 7c66dda..a56dc4d 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -18,7 +18,8 @@ diag "Create a CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -36,7 +37,7 @@ diag "apply the CF to General queue" if $ENV{'TEST_VERBOSE'};
 my ( $cf, $cfid, $tid );
 {
     $m->title_is(q/Created CustomField img/, 'admin-cf Created');
-    $m->follow_link( text => 'Queues' );
+    $m->follow_link( text => 'Queues', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Admin queues/, 'admin-queues screen');
     $m->follow_link( text => 'General', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Editing Configuration for queue General/, 'admin-queue: general');
@@ -115,7 +116,7 @@ diag "check that we have no the CF on the create"
 
     $m->follow_link( text => 'Custom Fields' );
     $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
-    $form = $m->form_number(3);
+    $form = $m->form_name('ticket_modify');
     ok !$form->find_input( "J:A:F-$cfid-$cf_moniker" ), 'no form field on the page';
 }
 
diff --git a/t/web/cf_onqueue.t b/t/web/cf_onqueue.t
index e12c759..986fdce 100644
--- a/t/web/cf_onqueue.t
+++ b/t/web/cf_onqueue.t
@@ -10,7 +10,8 @@ diag "Create a queue CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -51,7 +52,7 @@ diag "Edit the CF value for default queue" if $ENV{'TEST_VERBOSE'};
     $m->title_is(q/Editing Configuration for queue General/, 'default queue configuration screen');
     $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on default queue' );
     $m->submit_form(
-        form_number => 3,
+        form_name => 'queue_modify',
         # The following doesn't want to works :(
         #with_fields => { 'object-RT::Model::Queue-1-CustomField-1-value' },
         fields => {
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index 42b4b05..c76d5c2 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -17,7 +17,8 @@ diag "Create a CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -95,12 +96,12 @@ diag "check that values of the CF are case insensetive(asd vs. ASD)"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'correct value is selected';
     $m->submit;
     $m->content_unlike(qr/\Q$cf_name\E.*?changed/mi, 'field is not changed');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'the same value is still selected';
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
     $ticket->load( $tid );
@@ -117,14 +118,14 @@ diag "check that 0 is ok value of the CF"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'correct value is selected';
     $m->select("J:A:F-$cfid-$cf_moniker" => 0 );
     $m->submit;
     $m->content_like(qr/\Q$cf_name\E.*?changed/mi, 'field is changed');
     $m->content_unlike(qr/0 is no longer a value for custom field/mi, 'no bad message in results');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, '0', 'new value is selected';
 
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
@@ -142,13 +143,13 @@ diag "check that we can set empty value when the current is 0"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, '0', 'correct value is selected';
     $m->select("J:A:F-$cfid-$cf_moniker" => '' );
     $m->submit;
     $m->content_like(qr/0 is no longer a value for custom field/mi, '0 is no longer a value');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is $value, '', '(no value) is selected';
 
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 011a152..b5a53e8 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -74,16 +74,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
     foreach my $variant ( @variants ) {
         set_queue_crypt_options( %$variant );
         $m->goto_create_ticket( $queue );
-        $m->form_name('ticket_create');
+        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
+        my $sign    = $m->action_field_input('create_ticket', 'sign');
         if ( $variant->{'encrypt'} ) {
-            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $m->value('sign', 2), "sign tick box is checked";
+            ok $sign->value('sign'), "sign tick box is checked";
         } else {
-            ok !$m->value('sign', 2), "sign tick box is unchecked";
+            ok !$sign->value('sign'), "sign tick box is unchecked";
         }
     }
 
@@ -102,16 +103,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
         set_queue_crypt_options( %$variant );
         $m->goto_ticket( $id );
         $m->follow_link_ok({text => 'Reply'}, '-> reply');
-        $m->form_number(3);
+        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
+        my $sign    = $m->action_field_input('create_ticket', 'sign');
         if ( $variant->{'encrypt'} ) {
-            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $m->value('sign', 2), "sign tick box is checked";
+            ok $sign->value('sign'), "sign tick box is checked";
         } else {
-            ok !$m->value('sign', 2), "sign tick box is unchecked";
+            ok !$sign->value('sign'), "sign tick box is unchecked";
         }
     }
 }
@@ -259,16 +261,18 @@ sub create_a_ticket {
     RT::Test->clean_caught_mails;
 
     $m->goto_create_ticket( $queue );
-    $m->form_name('ticket_create');
-    $m->field( subject    => 'test' );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content    => 'Some content' );
+    $m->fill_in_action_ok('create_ticket' => (
+        subject    => 'test',
+        requestors => 'rt-test at example.com',
+        content    => 'Some content',
+    ));
+    my $form = $m->action_form('create_ticket');
 
     foreach ( qw(sign encrypt) ) {
         if ( $args{ $_ } ) {
-            $m->tick( $_ => 1 );
+            $form->tick( $_ => 1 );
         } else {
-            $m->untick( $_ => 1 );
+            $form->untick( $_ => 1 );
         }
     }
 
@@ -291,7 +295,7 @@ sub update_ticket {
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->field( update_content => 'Some content' );
 
     foreach ( qw(sign encrypt) ) {
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index d14094c..57af1b6 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -57,7 +57,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( sign => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -71,7 +71,6 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
 }
-
 {
     RT::Test->import_gnupg_key('rt-recipient at example.com');
     RT::Test->trust_gnupg_key('rt-recipient at example.com');
@@ -84,7 +83,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -98,7 +97,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -119,7 +118,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -133,7 +132,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -166,7 +165,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -180,7 +179,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -212,7 +211,7 @@ diag "check that we see key selector even if only one key is trusted but there a
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -226,7 +225,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -240,7 +239,7 @@ diag "check that key selector works and we can select trusted key"
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -254,7 +253,7 @@ diag "check that key selector works and we can select trusted key"
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -272,7 +271,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -287,7 +286,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index df115cd..e28f766 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -69,7 +69,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( sign => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -97,7 +97,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -111,7 +111,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -134,7 +134,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -148,7 +148,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -182,7 +182,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -196,7 +196,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -228,7 +228,7 @@ diag "check that we see key selector even if only one key is trusted but there a
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -242,7 +242,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -256,7 +256,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -270,7 +270,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -289,7 +289,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -304,7 +304,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 38ff64d..24f46de 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -146,7 +146,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
 {
     my $response = $agent->get($url."/Search/Edit.html");
     ok( $response->is_success, "Fetched /Search/Edit.html" );
-    ok($agent->form_number(3), "found the form");
+    ok($agent->form_name('query_edit'), "found the form");
     $agent->field("query", "Status = 'new' OR ( Status = 'open' AND subject LIKE 'office' )");
     $agent->submit;
     is( get_query_from_form,
@@ -234,7 +234,7 @@ diag "input a condition, select (several conditions), click delete"
 {
     my $response = $agent->get( $url."/Search/Edit.html" );
     ok $response->is_success, "Fetched /Search/Edit.html";
-    ok $agent->form_number(3), "found the form";
+    ok $agent->form_name('query_edit'), "found the form";
     $agent->field("query", "( Status = 'new' OR Status = 'open' )");
     $agent->submit;
     is( get_query_from_form,
diff --git a/t/web/rights.t b/t/web/rights.t
index 2645c08..cf6a256 100644
--- a/t/web/rights.t
+++ b/t/web/rights.t
@@ -16,7 +16,7 @@ sub get_rights {
     my $agent = shift;
     my $principal_id = shift;
     my $object = shift;
-    $agent->form_number(3);
+    $agent->form_name('group_rights_modify');
     my @inputs = $agent->current_form->find_input("revoke_right-$principal_id-$object");
     my @Rights = sort grep $_, map $_->possible_values, grep $_, @inputs;
     return @Rights;
@@ -33,7 +33,7 @@ my ($everyone, $everyone_gid);
 diag "revoke all global rights from Everyone group" if $ENV{'TEST_VERBOSE'};
 my @has = get_rights( $m, $everyone_gid, 'RT::System-1' );
 if ( @has ) {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->tick("revoke_right-$everyone_gid-RT::System-1", $_) foreach @has;
     $m->submit;
     
@@ -44,7 +44,7 @@ if ( @has ) {
 
 diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->select("grant_right-$everyone_gid-RT::System-1", ['SuperUser']);
     $m->submit;
 
@@ -56,7 +56,7 @@ diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 
 diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->tick("revoke_right-$everyone_gid-RT::System-1", 'SuperUser');
     $m->submit;
 
@@ -69,7 +69,7 @@ diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 
 diag "return rights the group had in the beginning" if $ENV{'TEST_VERBOSE'};
 if ( @has ) {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->select("grant_right-$everyone_gid-RT::System-1", \@has);
     $m->submit;
 
diff --git a/t/web/ticket_owner.t b/t/web/ticket_owner.t
index aeaea37..dc169a1 100644
--- a/t/web/ticket_owner.t
+++ b/t/web/ticket_owner.t
@@ -98,7 +98,7 @@ diag "user A can not change owner after create" if $ENV{TEST_VERBOSE};
         $agent->goto_ticket( $id );
         diag("Going to ticket $id") if $ENV{TEST_VERBOSE};
         $agent->follow_link_ok(text => 'Basics');
-        my $form = $agent->form_number(3);
+        my $form = $agent->form_name('ticket_modify');
         is $agent->action_field_value(
             $agent->moniker_for('RT::Action::UpdateTicket'), 'owner'
           ),
@@ -138,7 +138,7 @@ diag "on reply correct owner is selected" if $ENV{TEST_VERBOSE};
     $agent_a->goto_ticket( $id );
     $agent_a->follow_link_ok(text => 'Reply');
 
-    my $form = $agent_a->form_number(3);
+    my $form = $agent_a->form_name('ticket_update');
     is $form->value('owner'), '', 'empty value selected';
     $agent_a->submit;
 

commit 31213e386712d60727683f0d21db43b81c159c98
Merge: 784e4c0 69657b3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 15:41:00 2009 +0800

    merge emnu-take4

diff --cc t/web/gnupg-outgoing.t
index 8dc10c1,b5a53e8..1ea2d7d
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@@ -265,13 -266,13 +266,14 @@@ sub create_a_ticket 
          requestors => 'rt-test at example.com',
          content    => 'Some content',
      ));
+     my $form = $m->action_form('create_ticket');
  
      foreach ( qw(sign encrypt) ) {
 +        my $field = $m->action_field_input('create_ticket', $_);
          if ( $args{ $_ } ) {
-             $field->value(1);
+             $form->tick( $_ => 1 );
          } else {
-             $field->value(0);
+             $form->untick( $_ => 1 );
          }
      }
  

-----------------------------------------------------------------------


More information about the Rt-commit mailing list