summaryrefslogtreecommitdiffstats
path: root/xt/lib/QA/Util.pm
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-08-31 06:24:56 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-08-31 06:24:56 +0200
commit1df1a7b9ea4cd24235d344d495a874de40624612 (patch)
treef09a46880a81149cceceabe466cec1ea74d8d80b /xt/lib/QA/Util.pm
parent3a903b41328ba20072570c9fde36b332ea082f03 (diff)
downloadbugzilla-1df1a7b9ea4cd24235d344d495a874de40624612.tar.gz
bugzilla-1df1a7b9ea4cd24235d344d495a874de40624612.tar.xz
- Fixed API tests to work after login/email changes
Diffstat (limited to 'xt/lib/QA/Util.pm')
-rw-r--r--xt/lib/QA/Util.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/xt/lib/QA/Util.pm b/xt/lib/QA/Util.pm
index 90a6902e5..eb68a0b5b 100644
--- a/xt/lib/QA/Util.pm
+++ b/xt/lib/QA/Util.pm
@@ -18,6 +18,7 @@ use lib "$RealBin/../../lib", "$RealBin/../../../local/lib/perl5";
use autodie;
use Data::Dumper;
+use Email::Address;
use Test::More;
use parent qw(Exporter);
@@ -25,6 +26,7 @@ use parent qw(Exporter);
trim
url_quote
random_string
+ email_filter
log_in
logout
@@ -367,6 +369,18 @@ sub set_parameters {
}
}
+sub email_filter {
+ my ($toencode) = @_;
+ my @emails = Email::Address->parse($toencode);
+ if (scalar @emails) {
+ my @hosts = map { quotemeta($_->host) } @emails;
+ my $hosts_re = join('|', @hosts);
+ $toencode =~ s/\@(?:$hosts_re)//g;
+ return $toencode;
+ }
+ return $toencode;
+}
+
1;
__END__