diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-10-03 14:46:49 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-10-03 14:46:49 -0700 |
commit | 69d45d108aa60aca1099023cf669f489a8331086 (patch) | |
tree | 239f82f99cd676b5cdcae7858a04ea4a693fd47e /xt/lib | |
parent | fcc00da4d06dc666a7172c21831efa613f347324 (diff) | |
download | bugs-69d45d108aa60aca1099023cf669f489a8331086.tar bugs-69d45d108aa60aca1099023cf669f489a8331086.tar.gz bugs-69d45d108aa60aca1099023cf669f489a8331086.tar.bz2 bugs-69d45d108aa60aca1099023cf669f489a8331086.tar.xz bugs-69d45d108aa60aca1099023cf669f489a8331086.zip |
Bug 601499 - Make xt/search.t test the email(n)* search query parameters
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'xt/lib')
-rw-r--r-- | xt/lib/Bugzilla/Test/Search/Constants.pm | 14 | ||||
-rw-r--r-- | xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm | 13 |
2 files changed, 26 insertions, 1 deletions
diff --git a/xt/lib/Bugzilla/Test/Search/Constants.pm b/xt/lib/Bugzilla/Test/Search/Constants.pm index 7b06a0c95..9eb575017 100644 --- a/xt/lib/Bugzilla/Test/Search/Constants.pm +++ b/xt/lib/Bugzilla/Test/Search/Constants.pm @@ -28,6 +28,7 @@ package Bugzilla::Test::Search::Constants; use base qw(Exporter); use Bugzilla::Constants; +use Bugzilla::Util qw(generate_random_password); our @EXPORT = qw( ATTACHMENT_FIELDS @@ -146,12 +147,13 @@ use constant OR_SKIP => qw( # All the fields that represent users. use constant USER_FIELDS => qw( assigned_to + cc reporter qa_contact commenter attachments.submitter setters.login_name - requestees.login_name cc + requestees.login_name ); # For the "substr"-type searches, how short of a substring should @@ -1256,6 +1258,16 @@ use constant SPECIAL_PARAM_TESTS => ( contains => [1,2,3,4] }, { field => 'bug_status', operator => 'anyexact', value => '__all__', contains => [1,2,3,4,5] }, + + { field => 'assigned_to', operator => 'anyexact', + value => '<1>, <2-reporter>', contains => [1,2], + extra_params => { emailreporter1 => 1 } }, + { field => 'assigned_to', operator => 'equals', + value => '<1>', extra_name => 'email2', contains => [], + extra_params => { + email2 => generate_random_password(100), emaillongdesc2 => 1, + }, + } ); 1; diff --git a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm index 6f3564d0d..b3da598e4 100644 --- a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm +++ b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm @@ -34,6 +34,8 @@ use constant CH_OPERATOR => { changedto => 'chfieldvalue', }; +use constant EMAIL_FIELDS => qw(assigned_to qa_contact cc reporter commenter); + # Normally, we just clone a FieldTest because that's the best for performance, # overall--that way we don't have to translate the value again. However, # sometimes (like in Bugzilla::Test::Search's direct code) we just want @@ -78,6 +80,17 @@ sub search_params { if ($field eq 'deadline' and $operator eq 'lessthaneq') { return { deadlineto => $value }; } + + if (grep { $_ eq $field } EMAIL_FIELDS) { + $field = 'longdesc' if $field eq 'commenter'; + return { + email1 => $value, + "email${field}1" => 1, + emailtype1 => $operator, + # Used to do extra tests on special sorts of email* combinations. + %{ $self->test->{extra_params} || {} }, + }; + } $field =~ s/\./_/g; return { $field => $value, "${field}_type" => $operator }; |