page_links_ok eats SSL failure message
Opened this issue · 0 comments
ezarko commented
Moved from Issue #179 on Google Code.
If you attempt to access an https URL using LWP::UserAgent and you do not have SSL libraries installed you get a failure message providing specific guidance.
$ perl -MLWP::UserAgent -e 'my $ua = LWP::UserAgent->new();print $ua->get("https://www.example.com/login/")->content();'
LWP will support https URLs if the LWP::Protocol::https module
is installed.
If you use Test::WWW::Mechanize::get_ok with an https URL you also get a failure message providing specific guidance.
$ perl -MTest::More -MTest::WWW::Mechanize -e 'plan tests=>1;$mech=Test::WWW::Mechanize->new;$mech->get_ok("https://example.com/login/");'
1..1
not ok 1 - GET https://example.com/login/
# Failed test 'GET https://example.com/login/'
# at -e line 1.
#501
# Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)
# Looks like you failed 1 test of 1.
If you use Test::WWW::Mechanize::get_ok with an http URL to fetch a page containing one or more https URLs in the page and then call page_links_ok you should also get a failure message providing specific guidance, but you do not.
$ perl -MTest::More -MTest::WWW::Mechanize -e 'plan tests=>2;$mech=Test::WWW::Mechanize->new;$mech->get_ok("http://example.com/");$mech->page_links_ok;'
1..2
ok 1 - GET http://example.com/
not ok 2 - All links ok
# Failed test 'All links ok'
# at -e line 1.
# https://www.example.com/login/
# Looks like you failed 1 test of 2.
I would expect to see something like this:
$ perl -MTest::More -MTest::WWW::Mechanize -e 'plan tests=>2;$mech=Test::WWW::Mechanize->new;$mech->get_ok("http://example.com/");$mech->page_links_ok;'
1..2
ok 1 - GET http://example.com/
not ok 2 - All links ok
# Failed test 'All links ok'
# at -e line 1.
# https://www.example.com/login/
#501
# Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)
# Looks like you failed 1 test of 2.
Tested 4/12/2012 on Ubuntu using perl v5.12.4 and Test::WWW::Mechanize v1.38.