[Rt-commit] rt branch, admin_ui, updated. cd276a477859925a5e5861d374573f326b61211d

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 14 02:33:55 EST 2010


The branch, admin_ui has been updated
       via  cd276a477859925a5e5861d374573f326b61211d (commit)
      from  1f77a8c2f103a0e9ecb1ebfde00cb70bd5c0251a (commit)

Summary of changes:
 t/web/admin/queues.t |   71 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 56 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit cd276a477859925a5e5861d374573f326b61211d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jan 14 15:33:46 2010 +0800

    more admin queue tests

diff --git a/t/web/admin/queues.t b/t/web/admin/queues.t
index 267dabd..8ec5c4b 100644
--- a/t/web/admin/queues.t
+++ b/t/web/admin/queues.t
@@ -1,17 +1,17 @@
 #!/usr/bin/env perl
 
 use strict;
-use RT::Test strict => 0, tests => 33, l10n => 1;
+use RT::Test strict => 0, tests => 42, l10n => 1;
 
 my ( $baseurl, $agent ) = RT::Test->started_ok;
 ok( $agent->login, 'logged in' );
 
 my $root = RT::Model::User->new( current_user => RT->system_user );
-ok( $root->load( 'root' ), 'load user root' );
+ok( $root->load('root'), 'load user root' );
 
 $agent->get_ok('/admin/queues/');
 
-ok( $agent->find_link( text => 'General', url_regex => qr{\?id=1}, ),
+ok( $agent->find_link( text => 'General', url_regex => qr{\?id=\d+$}, ),
     "General link" );
 
 ok( !$agent->find_link( text => '___Approvals', ), "no ___Approvals link" );
@@ -30,11 +30,10 @@ ok(
     'exclude disabled link',
 );
 
-
 $agent->follow_link_ok( { text => 'General', url_regex => qr{\?id=1} },
     'follow General link' );
 
-# Basics 
+# Basics
 $agent->follow_link_ok( { text => 'Basics' }, 'follow Basic link' );
 my $moniker = 'update_queue';
 $agent->fill_in_action_ok( $moniker, initial_priority => 30 );
@@ -43,19 +42,21 @@ $agent->content_contains( 'Updated', 'updated queue' );
 my $queue = RT::Model::Queue->new( current_user => RT->system_user );
 ok( $queue->load('General'), 'load queue Generall' );
 is( $queue->initial_priority, 30, 'initial_priority is indeed updated' );
+
 # Watchers
 $agent->follow_link_ok( { text => 'Watchers' }, 'follow Watchers link' );
 $moniker = 'queue_edit_watchers';
 $agent->fill_in_action_ok( $moniker, cc_users => $root->id );
 $agent->submit;
 $agent->content_contains( 'Updated watchers', 'updated watchers' );
-my $cc_group = $queue->role_group( 'cc' );
+my $cc_group = $queue->role_group('cc');
 ok( $cc_group->has_member( principal => $root ),
     'cc role contains current user' );
 
-$agent->follow_link_ok( { text => 'Group Rights' }, 'follow Group Rights link' );
+$agent->follow_link_ok( { text => 'Group Rights' },
+    'follow Group Rights link' );
 my $privileged = RT::Model::Group->new( current_user => RT->system_user );
-ok( $privileged->load_system_internal( 'privileged' ), 'load group privileged' );
+ok( $privileged->load_system_internal('privileged'), 'load group privileged' );
 $moniker = 'queue_edit_group_rights';
 $agent->fill_in_action_ok( $moniker,
     'rights_' . $privileged->id => 'CreateTicket' );
@@ -64,13 +65,13 @@ $agent->content_contains( 'Updated rights', 'updated group rights' );
 my $acl_obj = RT::Model::ACECollection->new( current_user => RT->system_user );
 $acl_obj->limit_to_object($queue);
 $acl_obj->limit_to_principal( id => $privileged->id );
-is( $acl_obj->first->right_name, 'CreateTicket',
-    'privileged can create ticket in General' );
+is( $acl_obj->first->right_name,
+    'CreateTicket', 'privileged can create ticket in General' );
 
 $agent->follow_link_ok( { text => 'User Rights' }, 'follow User Rights link' );
 
 my $root_group = RT::Model::Group->new( current_user => RT->system_user );
-$root_group->load_acl_equivalence( $root );
+$root_group->load_acl_equivalence($root);
 $moniker = 'queue_edit_user_rights';
 $agent->fill_in_action_ok( $moniker,
     'rights_' . $root_group->principal_id => 'CreateTicket' );
@@ -80,12 +81,52 @@ $agent->content_contains( 'Updated rights', 'updated user rights' );
 $acl_obj = RT::Model::ACECollection->new( current_user => RT->system_user );
 $acl_obj->limit_to_object($queue);
 $acl_obj->limit_to_principal( id => $root->id );
-is( $acl_obj->first->right_name, 'CreateTicket',
-    'current user can create ticket in General' );
+is( $acl_obj->first->right_name,
+    'CreateTicket', 'current user can create ticket in General' );
+
+my $cf = RT::Model::CustomField->new( current_user => RT->system_user );
+
+ok(
+    $cf->create(
+        name        => 'cf_123',
+        type        => 'Freeform',
+        lookup_type => 'RT::Model::Queue-RT::Model::Ticket',
+    ),
+    'created cf cf_123 for ticket'
+);
 
 $agent->follow_link_ok( { text => 'Ticket Custom Fields' },
     'follow Ticket Custom Fields link' );
-$agent->follow_link_ok( { text => 'Transaction Custom Fields' }, 'follow Transaction Custom Fields link' );
-$agent->follow_link_ok( { text => 'GnuPG' }, 'follow GnuPG link' );
+
+$moniker = 'queue_select_cfs';
+$agent->fill_in_action_ok( $moniker, 'cfs' => $cf->id );
+$agent->submit;
+$agent->content_contains( 'Updated custom fields selection', 'select cf_123' );
+
+my $object_cfs =
+  RT::Model::ObjectCustomFieldCollection->new(
+    current_user => RT->system_user );
+$object_cfs->find_all_rows;
+$object_cfs->limit_to_object_id( $queue->id );
+$object_cfs->limit_to_lookup_type('RT::Model::Queue-RT::Model::Ticket');
+ok( $object_cfs->has_entry_for_custom_field( $cf->id ),
+    'we did select cf_123' );
+
+$agent->follow_link_ok(
+    { text => 'Transaction Custom Fields' },
+    'follow Transaction Custom Fields link'
+);
+$agent->follow_link_ok( { text => 'GnuPG' },     'follow GnuPG link' );
 $agent->follow_link_ok( { text => 'Templates' }, 'follow Templates link' );
 
+# let's create a queue
+$agent->get_ok('/admin/queues/');
+my $moniker = $agent->moniker_for('RT::Action::CreateQueue');
+$agent->fill_in_action_ok( $moniker, 'name' => 'queue_foo' );
+$agent->submit;
+$agent->content_contains( 'Created', 'created queue_foo' );
+my $queue_foo = RT::Model::Queue->new( current_user => RT->system_user );
+ok( $queue_foo->load('queue_foo'), 'did create queue_foo' );
+$agent->follow_link_ok( { text => 'General', url_regex => qr{\?id=\d+$} },
+    "queue_foo link" );
+

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


More information about the Rt-commit mailing list