summaryrefslogtreecommitdiffstats
path: root/xt/lib/Bugzilla/Test/Search
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-04 01:35:35 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-04 01:35:35 +0200
commit04871c9097e4d5108f17f316c78f35c25c32a0b1 (patch)
treebab8103da135ac27dddfb088eb68bbd57328cc94 /xt/lib/Bugzilla/Test/Search
parent9936d9f1631ef862fed0b7874db751c1be298402 (diff)
downloadbugzilla-04871c9097e4d5108f17f316c78f35c25c32a0b1.tar.gz
bugzilla-04871c9097e4d5108f17f316c78f35c25c32a0b1.tar.xz
Bug 601519 - Test pronouns (like %user%, %reporter%, etc.) in xt/search.t
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'xt/lib/Bugzilla/Test/Search')
-rw-r--r--xt/lib/Bugzilla/Test/Search/Constants.pm27
-rw-r--r--xt/lib/Bugzilla/Test/Search/FieldTest.pm8
2 files changed, 33 insertions, 2 deletions
diff --git a/xt/lib/Bugzilla/Test/Search/Constants.pm b/xt/lib/Bugzilla/Test/Search/Constants.pm
index e001ad6a5..aeb392c70 100644
--- a/xt/lib/Bugzilla/Test/Search/Constants.pm
+++ b/xt/lib/Bugzilla/Test/Search/Constants.pm
@@ -336,6 +336,9 @@ use constant CHANGED_VALUE_BROKEN => (
# while the other fails. In this case, we have a special override for
# "operator-value", which uniquely identifies tests.
use constant KNOWN_BROKEN => {
+ "equals-%group.<1-bug_group>%" => {
+ commenter => { contains => [1,2,3,4,5] },
+ },
notequals => { NEGATIVE_BROKEN },
notsubstring => { NEGATIVE_BROKEN },
notregexp => { NEGATIVE_BROKEN },
@@ -1262,6 +1265,7 @@ use constant SPECIAL_PARAM_TESTS => (
{ field => 'resolution', operator => 'anyexact', value => '---',
contains => [5] },
+ # email* query parameters.
{ field => 'assigned_to', operator => 'anyexact',
value => '<1>, <2-reporter>', contains => [1,2],
extra_params => { emailreporter1 => 1 } },
@@ -1270,7 +1274,28 @@ use constant SPECIAL_PARAM_TESTS => (
extra_params => {
email2 => generate_random_password(100), emaillongdesc2 => 1,
},
- }
+ },
+
+ # standard pronouns
+ { field => 'assigned_to', operator => 'equals', value => '%assignee%',
+ contains => [1,2,3,4,5] },
+ { field => 'reporter', operator => 'equals', value => '%reporter%',
+ contains => [1,2,3,4,5] },
+ { field => 'qa_contact', operator => 'equals', value => '%qacontact%',
+ contains => [1,2,3,4,5] },
+ { field => 'cc', operator => 'equals', value => '%user%',
+ contains => [1] },
+ # group pronouns
+ { field => 'reporter', operator => 'equals',
+ value => '%group.<1-bug_group>%', contains => [1,2,3,4,5] },
+ { field => 'assigned_to', operator => 'equals',
+ value => '%group.<1-bug_group>%', contains => [1,2,3,4,5] },
+ { field => 'qa_contact', operator => 'equals',
+ value => '%group.<1-bug_group>%', contains => [1,2,3,4] },
+ { field => 'cc', operator => 'equals',
+ value => '%group.<1-bug_group>%', contains => [1,2,3,4] },
+ { field => 'commenter', operator => 'equals',
+ value => '%group.<1-bug_group>%', contains => [1,2,3,4,5] },
);
1;
diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
index f73facb19..3e7fd2521 100644
--- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm
+++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
@@ -431,7 +431,13 @@ sub _translate_value_for_bug {
$value =~ s/<$number-delta>/$bug_delta/g;
my $reporter = $bug->reporter->login;
$value =~ s/<$number-reporter>/$reporter/g;
-
+ if ($value =~ /<$number-bug_group>/) {
+ my @bug_groups = map { $_->name } @{ $bug->groups_in };
+ @bug_groups = grep { $_ =~ /^\d+-group-/ } @bug_groups;
+ my $group = $bug_groups[0];
+ $value =~ s/<$number-bug_group>/$group/g;
+ }
+
my @bug_values = $self->bug_values($number);
return $value if !@bug_values;