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

? sunnavy sunnavy at bestpractical.com
Thu Jan 26 01:15:20 EST 2012


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

Summary of changes:
 t/web/query_builder_queue_limits.t |   54 +++++++++++++++++++++++++++--------
 1 files changed, 41 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit 1336314b9e8018d4b8a8aa9d46c88e2f11203b2c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jan 26 14:11:22 2012 +0800

    more queue limit tests with "!=" or "OR" in sql
    
    also refactored a bit to use RT::Test->load_or_create_...

diff --git a/t/web/query_builder_queue_limits.t b/t/web/query_builder_queue_limits.t
index 6ba679f..2ef8453 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 => 22;
+use RT::Test tests => 28;
 
 my $lifecycles = RT->Config->Get('Lifecycles');
 $lifecycles->{foo} = {
@@ -13,33 +13,25 @@ $lifecycles->{foo} = {
 
 RT::Lifecycle->FillCache();
 
-my $foo = RT::Queue->new($RT::SystemUser);
-my ( $id, $msg ) = $foo->Create( Name => 'foo', Lifecycle => 'foo' );
-ok( $id, 'created queue foo' );
+my $foo = RT::Test->load_or_create_queue( Name => 'foo', Lifecycle => 'foo' );
 
-my $global_cf = RT::CustomField->new($RT::SystemUser);
-( $id, $msg ) = $global_cf->Create(
+my $global_cf = RT::Test->load_or_create_custom_field(
     Name  => 'global_cf',
     Queue => 0,
     Type  => 'FreeformSingle',
 );
-ok( $id, 'create global_cf' );
 
-my $general_cf = RT::CustomField->new($RT::SystemUser);
-( $id, $msg ) = $general_cf->Create(
+my $general_cf = RT::Test->load_or_create_custom_field(
     Name  => 'general_cf',
     Queue => 'General',
     Type  => 'FreeformSingle',
 );
-ok( $id, 'create general_cf' );
 
-my $foo_cf = RT::CustomField->new($RT::SystemUser);
-( $id, $msg ) = $foo_cf->Create(
+my $foo_cf = RT::Test->load_or_create_custom_field(
     Name  => 'foo_cf',
     Queue => 'foo',
     Type  => 'FreeformSingle'
 );
-ok( $id, 'create foo_cf' );
 
 my ( $url, $m ) = RT::Test->started_ok;
 ok( $m->login, 'logged in' );
@@ -96,3 +88,39 @@ is_deeply(
     'found all statuses again'
 );
 
+diag "limit queue to != foo";
+$m->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+$m->submit_form(
+    form_name => 'BuildQuery',
+    fields => { ValueOfQueue => 'foo', QueueOp => '!=' },
+    button => 'AddClause',
+);
+
+$form = $m->form_name('BuildQuery');
+ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
+ok( !$form->find_input("ValueOf'CF.{foo_cf}'"), 'no foo_cf' );
+ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'no general_cf' );
+$status_input = $form->find_input('ValueOfStatus');
+ at statuses     = sort $status_input->possible_values;
+is_deeply(
+    \@statuses, [ '', qw/initial new open rejected resolved stalled/],
+    'found all statuses'
+);
+
+diag "limit queue to General OR foo";
+$m->get_ok( $url . '/Search/Edit.html' );
+$m->submit_form(
+    form_name => 'BuildQueryAdvanced',
+    fields => { Query => q{Queue = 'General' OR Queue = 'foo'} },
+);
+$form = $m->form_name('BuildQuery');
+ok( $form->find_input("ValueOf'CF.{general_cf}'"), 'found general_cf' );
+ok( $form->find_input("ValueOf'CF.{foo_cf}'"), 'found foo_cf' );
+ok( $form->find_input("ValueOf'CF.{global_cf}'"), 'found global_cf' );
+$status_input = $form->find_input('ValueOfStatus');
+ at statuses     = sort $status_input->possible_values;
+is_deeply(
+    \@statuses,
+    [ '', qw/initial new open rejected resolved stalled/ ],
+    'found all statuses'
+);

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


More information about the Rt-commit mailing list