[Rt-commit] r8958 - in rt/branches/3.7-EXPERIMENTAL: . html/User
sartak at bestpractical.com
sartak at bestpractical.com
Thu Sep 6 20:00:16 EDT 2007
Author: sartak
Date: Thu Sep 6 20:00:15 2007
New Revision: 8958
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html
rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
Log:
r42403 at onn: sartak | 2007-09-06 19:59:16 -0400
Add some basic tests for key selection, and fix a bug with the key selection not being accepted
Modified: rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/User/Prefs.html Thu Sep 6 20:00:15 2007
@@ -225,7 +225,7 @@
Organization RealName NickName Lang EmailEncoding WebEncoding
ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
- Address2 City State Zip Country Lang
+ Address2 City State Zip Country Lang PreferredKey
);
$m->callback(
Modified: rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t (original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t Thu Sep 6 20:00:15 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 80;
+use Test::More tests => 94;
use RT::Test;
use RT::Action::SendEmail;
@@ -44,6 +44,8 @@
RT::Test->import_gnupg_key('recipient at example.com', 'secret');
RT::Test->import_gnupg_key('general at example.com', 'public');
RT::Test->import_gnupg_key('general at example.com', 'secret');
+RT::Test->import_gnupg_key('general at example.com.2', 'public');
+RT::Test->import_gnupg_key('general at example.com.2', 'secret');
ok(my $user = RT::User->new($RT::SystemUser));
ok($user->Load('root'), "Loaded user 'root'");
@@ -385,6 +387,34 @@
"Correct subject"
);
+# test key selection
+ok($user = RT::User->new($RT::SystemUser));
+ok($user->Load('root'), "Loaded user 'root'");
+is($user->PreferredKey, "9FA662C06DE22FC2", "preferred key is set correctly");
+$m->get("$baseurl/User/Prefs.html");
+like($m->content, qr/Preferred Key/, "preferred key option shows up in preference");
+
+# XXX: mech doesn't let us see the current value of the select, apparently
+like($m->content, qr/9FA662C06DE22FC2/, "first key shows up in preferences");
+like($m->content, qr/DF651FA0632C4F50/, "second key shows up in preferences");
+like($m->content, qr/9FA662C06DE22FC2.*?DF651FA0632C4F50/s, "first key shows up before the second");
+
+$m->form_number(3);
+$m->select("PreferredKey" => "DF651FA0632C4F50");
+$m->submit;
+
+ok($user = RT::User->new($RT::SystemUser));
+ok($user->Load('root'), "Loaded user 'root'");
+is($user->PreferredKey, "DF651FA0632C4F50", "preferred key is set correctly to the new value");
+
+$m->get("$baseurl/User/Prefs.html");
+like($m->content, qr/Preferred Key/, "preferred key option shows up in preference");
+
+# XXX: mech doesn't let us see the current value of the select, apparently
+like($m->content, qr/DF651FA0632C4F50/, "second key shows up in preferences");
+like($m->content, qr/9FA662C06DE22FC2/, "first key shows up in preferences");
+like($m->content, qr/DF651FA0632C4F50.*?9FA662C06DE22FC2/s, "second key (now preferred) shows up before the first");
+
# test that the new fields work
$m->get("$baseurl/Search/Simple.html?q=General");
my $content = $m->content;
More information about the Rt-commit
mailing list