[Rt-commit] rt branch, 4.0/querybuilder-queue-limits, updated. rt-4.0.2-126-g33451e6

? sunnavy sunnavy at bestpractical.com
Thu Jan 26 19:07:26 EST 2012


The branch, 4.0/querybuilder-queue-limits has been updated
       via  33451e6fc00f49381e7e003f1a04c48359d02572 (commit)
      from  1336314b9e8018d4b8a8aa9d46c88e2f11203b2c (commit)

Summary of changes:
 t/web/query_builder_queue_limits.t |   58 ++++++++++++++++++++++++++++++++++-
 1 files changed, 56 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 33451e6fc00f49381e7e003f1a04c48359d02572
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jan 27 08:04:51 2012 +0800

    owner tests for queue limits in query builder

diff --git a/t/web/query_builder_queue_limits.t b/t/web/query_builder_queue_limits.t
index 2ef8453..a3b9765 100644
--- a/t/web/query_builder_queue_limits.t
+++ b/t/web/query_builder_queue_limits.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 28;
+use RT::Test tests => 34;
 
 my $lifecycles = RT->Config->Get('Lifecycles');
 $lifecycles->{foo} = {
@@ -13,6 +13,7 @@ $lifecycles->{foo} = {
 
 RT::Lifecycle->FillCache();
 
+my $general = RT::Test->load_or_create_queue( Name => 'General' );
 my $foo = RT::Test->load_or_create_queue( Name => 'foo', Lifecycle => 'foo' );
 
 my $global_cf = RT::Test->load_or_create_custom_field(
@@ -33,12 +34,38 @@ my $foo_cf = RT::Test->load_or_create_custom_field(
     Type  => 'FreeformSingle'
 );
 
+my $root = RT::Test->load_or_create_user( Name => 'root', );
+my $user_a = RT::Test->load_or_create_user(
+    Name     => 'user_a',
+    Password => 'password',
+);
+my $user_b = RT::Test->load_or_create_user(
+    Name     => 'user_b',
+    Password => 'password',
+);
+
+ok(
+    RT::Test->set_rights(
+        {
+            Principal => $user_a,
+            Object    => $general,
+            Right     => ['OwnTicket'],
+        },
+        {
+            Principal => $user_b,
+            Object    => $foo,
+            Right     => ['OwnTicket'],
+        },
+    ),
+    'granted OwnTicket right for user_a and user_b'
+);
+
 my ( $url, $m ) = RT::Test->started_ok;
 ok( $m->login, 'logged in' );
 
 $m->get_ok( $url . '/Search/Build.html' );
 
-diag "check default statuses and cf";
+diag "check default statuses, cf and owners";
 my $form = $m->form_name('BuildQuery');
 ok( $form,                                     'found BuildQuery form' );
 ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf by default' );
@@ -51,6 +78,12 @@ is_deeply(
     \@statuses, [ '', qw/initial new open rejected resolved stalled/], 'found all statuses'
 );
 
+my $owner_input = $form->find_input('ValueOfActor');
+my @owners     = sort $owner_input->possible_values;
+is_deeply(
+    \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+);
+
 diag "limit queue to foo";
 $m->submit_form(
     fields => { ValueOfQueue => 'foo' },
@@ -69,6 +102,12 @@ is_deeply(
     'found statuses from foo only'
 );
 
+$owner_input = $form->find_input('ValueOfActor');
+ at owners     = sort $owner_input->possible_values;
+is_deeply(
+    \@owners, [ '', qw/Nobody root user_b/], 'no user_a'
+);
+
 diag "limit queue to general too";
 
 $m->submit_form(
@@ -87,6 +126,11 @@ is_deeply(
     [ '', qw/initial new open rejected resolved stalled/ ],
     'found all statuses again'
 );
+$owner_input = $form->find_input('ValueOfActor');
+ at owners     = sort $owner_input->possible_values;
+is_deeply(
+    \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users again'
+);
 
 diag "limit queue to != foo";
 $m->get_ok( $url . '/Search/Build.html?NewQuery=1' );
@@ -106,6 +150,11 @@ is_deeply(
     \@statuses, [ '', qw/initial new open rejected resolved stalled/],
     'found all statuses'
 );
+$owner_input = $form->find_input('ValueOfActor');
+ at owners     = sort $owner_input->possible_values;
+is_deeply(
+    \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+);
 
 diag "limit queue to General OR foo";
 $m->get_ok( $url . '/Search/Edit.html' );
@@ -124,3 +173,8 @@ is_deeply(
     [ '', qw/initial new open rejected resolved stalled/ ],
     'found all statuses'
 );
+$owner_input = $form->find_input('ValueOfActor');
+ at owners     = sort $owner_input->possible_values;
+is_deeply(
+    \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
+);

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


More information about the Rt-commit mailing list