[Rt-commit] [rtir] 09/14: MakeClicky tests were inaccurate and had been failing pretty consistently
Jesse Vincent
jesse at bestpractical.com
Wed Feb 18 20:55:07 EST 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit ed6463dbbc5dfeffa10f2c097ea950289585304e
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Feb 18 16:54:20 2015 -0800
MakeClicky tests were inaccurate and had been failing pretty consistently
---
t/015-make-clicky.t | 41 +++++++++++++++++++++++++++++++----------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/t/015-make-clicky.t b/t/015-make-clicky.t
index 761fc64..6f9b398 100644
--- a/t/015-make-clicky.t
+++ b/t/015-make-clicky.t
@@ -60,13 +60,12 @@ diag "clicky email" if $ENV{'TEST_VERBOSE'};
my $id =
$agent->create_ir( { Subject => 'clicky email', Content => $email } );
$agent->display_ticket($id);
- my $email_link = $agent->find_link( text_regex => qr/\Qlookup email\E$/ );
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
$agent->save_content('/tmp/x.html');
if ( $clicky{'email'} ) {
- ok( $email_link, "found link" );
- ok( $email_link->url =~ /(?<!\w)\Q$email\E(?!\w)/, 'url '.$email_link->url.' has an email - '.$email );
-
+ ok( $email_link, "found link $email_link" );
+ ok( $email_link->url =~ /(?<!\w)\Qq=$email\E(?!\w)/, 'url '.$email_link->url.' has an email - '.$email );
ok( $domain_link, "found link" );
ok( $domain_link->url =~ /(?<!\w)\Q$domain\E(?!\w)/, 'url has a domain' );
}
@@ -77,17 +76,39 @@ diag "clicky email" if $ENV{'TEST_VERBOSE'};
}
- for my $email ( 'foo at example', '@example.com', ) {
- diag "test invalid email $email" if $ENV{TEST_VERBOSE};
+ for my $email ( 'foo at example') {
+ diag "test invalid email (invalid domain) $email" if $ENV{TEST_VERBOSE};
- my ( $name, $domain ) = split /@/, $email, 2;
+ my ( $name, $domain );
+ if ($email =~ /^(.*)@(.*)$/) {
+ ($name,$domain) = ($1,$2);
+ }
+ my $id = $agent->create_ir( { Subject => 'clicky email', Content => $email } );
+ $agent->display_ticket($id);
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
+ ok( !$email_link, "not found email link for $email" );
+ my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
+ ok( !$domain_link, "not found domain link for $domain" );
+
+ }
+
+
+ for my $email ( '@example.com' ) {
+ diag "test invalid email (no local part) $email" if $ENV{TEST_VERBOSE};
+
+ my ( $name, $domain );
+ if ($email =~ /^(.*)@(.*)$/) {
+ ($name,$domain) = ($1,$2);
+ }
my $id = $agent->create_ir( { Subject => 'clicky email', Content => $email } );
$agent->display_ticket($id);
- my $email_link = $agent->find_link( text_regex => qr/\Qlookup email\E$/ );
- ok( !$email_link, "not found email link" );
+ my $email_link = $agent->find_link( url_regex => qr/\Qq=$email\E/, text_regex => qr/\Qlookup email\E$/ );
+ ok( !$email_link, "not found email link for $email" );
my $domain_link = $agent->find_link( text_regex => qr/^\Qlookup "$domain"\E$/i );
- ok( !$domain_link, "not found domain link" );
+ ok( $domain_link, "still found the bare domain for $domain" );
}
+
+
}
diag "utf8 caching " if $ENV{'TEST_VERBOSE'};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list