[Rt-commit] r14191 - rtir/branches/2.3-TESTING/t

ruz at bestpractical.com ruz at bestpractical.com
Wed Jul 16 21:05:11 EDT 2008


Author: ruz
Date: Wed Jul 16 21:04:58 2008
New Revision: 14191

Modified:
   rtir/branches/2.3-TESTING/t/006-saved-searches.t

Log:
* update tests according to the latest code

Modified: rtir/branches/2.3-TESTING/t/006-saved-searches.t
==============================================================================
--- rtir/branches/2.3-TESTING/t/006-saved-searches.t	(original)
+++ rtir/branches/2.3-TESTING/t/006-saved-searches.t	Wed Jul 16 21:04:58 2008
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More 'no_plan';
+use Test::More tests => 15;
 
 require "t/rtir-test.pl";
 
@@ -28,7 +28,7 @@
 
 $agent->form_name("BuildQuery");
 is($agent->value('SavedSearchDescription'), $search1, "name is correct");
-ok_and_content_like($agent, qr{Privacy:\s*My saved searches}s, "privacy is fixed");
+like($agent->value('SavedSearchOwner'), qr/^RT::User-\d+$/, "privacy is correct");
 
 # add some other random clause in order to change the search, so we can save it again
 
@@ -39,7 +39,7 @@
 
 $agent->form_name("BuildQuery");
 is($agent->value('SavedSearchDescription'), $search1, "name is correct");
-ok_and_content_like($agent, qr{Privacy:\s*My saved searches}s, "privacy is fixed");
+like($agent->value('SavedSearchOwner'), qr/^RT::User-\d+$/, "privacy is correct");
 
 # copy query
 $agent->form_name("BuildQuery");
@@ -49,17 +49,21 @@
 is($agent->field('SavedSearchDescription'), "$search1 copy", "copied search");
 
 # figure out how to change the privacy popup. (can't use like, since that ends up clobbering $1)
-$agent->content =~ qr{<option value="RT::User-\d+">My saved searches</option>\s*<option value="RT::Group-(\d+)">DutyTeam's saved searches</option>}s;
-my $DT_id = $1;
+my ($group_id) = grep defined && length,
+    map { /^RT::Group-(\d+)$/ and $1 }
+    $agent->current_form->find_input('SavedSearchOwner')->possible_values;
+
+my $DT_id = $group_id;
 ok($DT_id, "found dutyteam ID");
 
 $agent->select(SavedSearchOwner => "RT::Group-$DT_id");
 my $search2 = "saved".rand();
 $agent->field(SavedSearchDescription => $search2);
 $agent->click("SavedSearchSave");
-ok_and_content_like($agent, 
-                    qr{<option value="">DutyTeam's saved searches</option>.*<option value="RT::Group[^"]+"> -$search2</option>}s,
-                    "saved DT search");
+
+$agent->form_name("BuildQuery");
+is($agent->field('SavedSearchDescription'), $search2, "correct name of the search");
+is($agent->value('SavedSearchOwner'), "RT::Group-$DT_id", "privacy is correct");
 
 
 # ... should also do tests for the RTIR "refine" thing, which is like QB.


More information about the Rt-commit mailing list