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

sartak at bestpractical.com sartak at bestpractical.com
Tue Nov 24 20:00:55 EST 2009


The branch, 3.999-trunk has been updated
       via  a0c5441e54e132b05d111faa023ff65ba632cc86 (commit)
      from  7af738f89515868eb7f555dd3d97cd8c78795239 (commit)

Summary of changes:
 t/web/gnupg-select-keys-on-create.t |  123 ++++++++++++++++++++++-------------
 1 files changed, 77 insertions(+), 46 deletions(-)

- Log -----------------------------------------------------------------
commit a0c5441e54e132b05d111faa023ff65ba632cc86
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 20:00:13 2009 -0500

    jiftyify select-keys-on-create

diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index 57af1b6..6e60de7 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -57,10 +57,11 @@ 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->tick( sign => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        sign       => 1,
+        requestors => 'rt-test at example.com',
+        content    => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/unable to sign outgoing email messages/i,
@@ -83,10 +84,11 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -97,8 +99,12 @@ 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');
-    ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
@@ -118,10 +124,11 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -132,9 +139,13 @@ 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');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 1, 'one option';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 1, 'one option';
+    }
+    else {
+        fail("could not find create_ticket form");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -165,10 +176,11 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -179,9 +191,13 @@ 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');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -211,10 +227,11 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -225,9 +242,13 @@ 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');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
@@ -239,10 +260,11 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -253,9 +275,13 @@ diag "check that key selector works and we can select trusted key"
         'problems with keys'
     );
 
-    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';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -271,11 +297,12 @@ 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->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
-    $m->field( attach => $0 );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+        attach => $0,
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -286,9 +313,13 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    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';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;

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


More information about the Rt-commit mailing list