[Rt-commit] rt branch, 4.0/test-admin-user-gnupg, created. rt-4.0.10-62-g1f77b83

? sunnavy sunnavy at bestpractical.com
Mon Feb 25 10:33:20 EST 2013


The branch, 4.0/test-admin-user-gnupg has been created
        at  1f77b832803c6c55199c468c3e100e3c5ae5e161 (commit)

- Log -----------------------------------------------------------------
commit 1f77b832803c6c55199c468c3e100e3c5ae5e161
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Feb 25 23:20:28 2013 +0800

    tests for /Admin/User/GnuPG.html

diff --git a/t/web/admin_user.t b/t/web/admin_user.t
index 24156a9..36b9af1 100644
--- a/t/web/admin_user.t
+++ b/t/web/admin_user.t
@@ -2,7 +2,18 @@
 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 at example.com', 'secret' );
+
+ok( my $user = RT::User->new( RT->SystemUser ) );
+ok( $user->Load('root'), "loaded user 'root'" );
+$user->SetEmailAddress('rt-test at example.com');
 
 my ( $url, $m ) = RT::Test->started_ok;
 ok( $m->login(), 'logged in' );
@@ -16,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;

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


More information about the Rt-commit mailing list