Skip to content

Commit 249a23f

Browse files
committed
MM-XXXX
Fix embedded_style_block.t. Related PR would always fail. Reason for this is that LWP::Simple->get() does not pass a proper user agent, and is blocked by a very large number of webservers, including rawgit. The requirement, to fetch a remote file, is already accounted for within this particular library. I basically removed the get() request, and then shuffled some code around. If Inliner is unable to request the file, we will now fail before attempting to inline. Otherwise it will proceed as normal. We'll see if there are other unstated issues that the previous approach was dealing with.
1 parent 97edbc3 commit 249a23f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/embedded_style_block.t

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ use LWP::Simple;
99

1010
use FindBin qw($Bin);
1111

12-
eval {
13-
get('https://rawgit.com') or die $@;
14-
};
15-
16-
# conditional test plan based on whether or not the endpoint can be reached - frequently can't by cpan testers
17-
plan $@ ? (skip_all => 'Connectivity for endpoint required for test cannot be established') : (tests => 1);
18-
1912
my $html_path = "$Bin/html/";
2013
my $test_url = 'https://rawgit.com/kamelkev/CSS-Inliner/master/t/html/embedded_style.html';
2114
my $result_file = $html_path . 'embedded_style_result.html';
@@ -24,7 +17,14 @@ open( my $fh, $result_file ) or die "can't open $result_file: $!!\n";
2417
my $correct_result = do { local( $/ ) ; <$fh> } ;
2518

2619
my $inliner = CSS::Inliner->new();
27-
$inliner->fetch_file({ url => $test_url });
20+
21+
eval {
22+
$inliner->fetch_file({ url => $test_url });
23+
};
24+
25+
## conditional test plan based on whether or not the endpoint can be reached - frequently can't by cpan testers
26+
plan $@ ? (skip_all => 'Connectivity for endpoint required for test cannot be established') : (tests => 1);
27+
2828
my $inlined = $inliner->inlinify();
2929

3030
ok($inlined eq $correct_result, 'result was correct');

0 commit comments

Comments
 (0)