Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Philippe 'BooK' Bruhat
Le mercredi 05 mars 2003 à 19:38, Robert Spier écrivait:
 
  There really aren't many tests that are meaningful without that access. 
00.load.t, 99.pod and add_header.t are all that seem to be valid 
  without it.
 
 You could allow the user to choose between internal and external
 tests, where the internal tests are much simpler, maybe including a
 trivial self-contained webserver to make sure everything works.

The server could be a HTTP::Daemon. That's how I test the basic workings
of HTTP::Proxy.

Some tests use google.com and other webservers. They can be skipped
if the test script detects that for some reason the web does not work.

(Oops, I seem to remember this is in version 0.08, which is not out yet.
You can fetch a repository snapshot from http://http-proxy.mongueurs.net/
Have a look at t/22http.t and t/Utils.pm)

-- 
 Philippe BooK Bruhat

 Friends are people who are there when you need them. (also applies to dogs)
(Moral from Groo The Wanderer #43 (Epic))


Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Andy Lester
You could allow the user to choose between internal and external
tests, where the internal tests are much simpler, maybe including a
trivial self-contained webserver to make sure everything works.
Help me out here.  I'm trying to imagine why someone would want 
WWW::Mechanize without a net connection.  Or are you saying that people 
will want to use it strictly behind a restrictive firewall where 
google.com isn't accessible?

xoa

--
Andy Lester, lead singer  driver of the Winnebago
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/


Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Robert Spier
 Help me out here.  I'm trying to imagine why someone would want 
 WWW::Mechanize without a net connection.  Or are you saying that people 
 will want to use it strictly behind a restrictive firewall where 
 google.com isn't accessible?

Yes.

-R


Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Leon Brocard
Andy Lester sent the following bits through the ether:

 Or are you saying that people will want to use it strictly behind a
 restrictive firewall where google.com isn't accessible?

For example, we use it at work for testing our web applications. The
slightly overly-secure server we use for developing can not see the
Internet, but it can test on localhost or other internal
servers. (There's a local CPAN mirror and other such things to make it
bearable).

Leon

ps thanks for the module! ;-)
-- 
Leon Brocard.http://www.astray.com/
scribot.http://www.scribot.com/

... Clap on! (clap, clap) Clap off! ([EMAIL PROTECTED]$NO CARRIER


Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Andy Lester
For example, we use it at work for testing our web applications. The
slightly overly-secure server we use for developing can not see the
Internet, but it can test on localhost or other internal
servers. (There's a local CPAN mirror and other such things to make it
bearable).
I've created RT ticket #2185.  If anyone would like to implement this 
and submit the patch to me, I'd appreciate it.  I'm fresh out of tuits 
for implementing daemons on the fly.

xoa

--
Andy Lester, lead singer  driver of the Winnebago
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/


Re: WWW::Mechanize 0.37 released

2003-03-06 Thread Philippe 'BooK' Bruhat
Le jeudi 06 mars 2003 à 10:43, Andy Lester écrivait:
 For example, we use it at work for testing our web applications. The
 slightly overly-secure server we use for developing can not see the
 Internet, but it can test on localhost or other internal
 servers. (There's a local CPAN mirror and other such things to make it
 bearable).
 
 I've created RT ticket #2185.  If anyone would like to implement this 
 and submit the patch to me, I'd appreciate it.  I'm fresh out of tuits 
 for implementing daemons on the fly.

Here are (very) simple SKIP blocks with a basic web_ok() function.

One could go one step further and put sample pages in t/, as well as
a basic HTTP::Daemon script that would return them when asked for,
and 404 when they are not found.

I'll try to post a set of dummy_*.t files (reproducing the tests in your
own test suite) doing just that in a few days (no promise, though).

Then testing the module would not depend on the web at all.


-- Philippe


Only in WWW-Mechanize/t: Utils.pm

package main;

# check that the web connection is working
sub web_ok {
my $ua = LWP::UserAgent-new( env_proxy = 1 );
my $res =
  $ua-request(
HTTP::Request-new( GET = 'http://www.google.com/intl/en/' ) );
return $res-is_success;
}

1;

diff -ru WWW-Mechanize-0.37/t/click.t WWW-Mechanize/t/click.t
--- WWW-Mechanize-0.37/t/click.t2003-03-04 22:06:03.0 +0100
+++ WWW-Mechanize/t/click.t 2003-03-06 18:21:12.0 +0100
@@ -1,6 +1,7 @@
 use warnings;
 use strict;
 use Test::More tests = 8;
+use t::Utils;
 
 BEGIN {
 use_ok( 'WWW::Mechanize' );
@@ -9,6 +10,9 @@
 my $t = WWW::Mechanize-new();
 isa_ok( $t, 'WWW::Mechanize', 'Created the object' );
 
+SKIP: {
+skip Web does not seem to work, 6 unless web_ok();
+
 my $response = $t-get( http://www.google.com/intl/en/;);
 isa_ok( $response, 'HTTP::Response', 'Got back a response' );
 ok( $response-is_success, 'Got google' ) or die Can't even fetch google;
@@ -21,3 +25,5 @@
 ok( $response-is_success, Can click 'btnG' ('Google Search' button));
 
 like($t-content, qr/foo\s?fighters/i, Found 'Foo Fighters');
+
+}

diff -ru WWW-Mechanize-0.37/t/follow.t WWW-Mechanize/t/follow.t
--- WWW-Mechanize-0.37/t/follow.t   2003-02-04 17:29:18.0 +0100
+++ WWW-Mechanize/t/follow.t2003-03-06 18:20:24.0 +0100
@@ -2,6 +2,7 @@
 use strict;
 use Test::More tests = 14;
 use constant START = 'http://www.google.com/intl/en/';
+use t::Utils;
 
 BEGIN {
 use_ok( 'WWW::Mechanize' );
@@ -11,6 +12,9 @@
 isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
 $agent-quiet(1);
 
+SKIP: {
+skip Web does not seem to work, 12 unless web_ok();
+
 my $response = $agent-get( START );
 ok( $response-is_success, 'Got some page' );
 is( $agent-uri, START, 'Got Google' );
@@ -30,3 +34,5 @@
 
 ok($agent-back(), Can still go back);
 is( $agent-uri, START, 'Back at the start page again' );
+
+}

diff -ru WWW-Mechanize-0.37/t/form.t WWW-Mechanize/t/form.t
--- WWW-Mechanize-0.37/t/form.t 2003-02-04 17:44:46.0 +0100
+++ WWW-Mechanize/t/form.t  2003-03-06 18:21:50.0 +0100
@@ -3,6 +3,7 @@
 use warnings;
 use strict;
 use Test::More tests = 14;
+use t::Utils;
 
 use constant START = 'http://www.google.com/intl/en/';
 
@@ -13,6 +14,10 @@
 my $t = WWW::Mechanize-new();
 isa_ok( $t, 'WWW::Mechanize' );
 $t-quiet(1);
+
+SKIP: {
+skip Web does not seem to work, 12 unless web_ok();
+
 my $response = $t-get(START);
 ok( $response-is_success, Got a page ) or die Can't even get google;
 is( $t-uri, START, 'Got Google' );
@@ -37,3 +42,5 @@
 my $form_f = $t-form('f');
 ok( $form_f );
 is( $form_f, $form_name_f );
+
+}

diff -ru WWW-Mechanize-0.37/t/get.t WWW-Mechanize/t/get.t
--- WWW-Mechanize-0.37/t/get.t  2003-03-04 22:01:14.0 +0100
+++ WWW-Mechanize/t/get.t   2003-03-06 18:20:40.0 +0100
@@ -1,6 +1,7 @@
 use warnings;
 use strict;
 use Test::More tests = 27;
+use t::Utils;
 
 BEGIN {
 use_ok( 'WWW::Mechanize' );
@@ -9,6 +10,9 @@
 my $agent = WWW::Mechanize-new;
 isa_ok( $agent, 'WWW::Mechanize', 'Created object' );
 
+SKIP: {
+skip Web does not seem to work, 25 unless web_ok();
+
 ok($agent-get(http://www.google.com/intl/en/;)-is_success, Get google webpage);
 isa_ok($agent-uri, URI, Set uri);
 isa_ok($agent-req, 'HTTP::Request', req should be a HTTP::Request);
@@ -39,3 +43,5 @@
 
 ok( $agent-get( http://www.google.com/images/logo.gif; )-is_success, Got the 
logo );
 ok( !$agent-is_html );
+
+}

diff -ru WWW-Mechanize-0.37/t/page_stack.t WWW-Mechanize/t/page_stack.t
--- WWW-Mechanize-0.37/t/page_stack.t   2002-10-24 05:52:55.0 +0200
+++ WWW-Mechanize/t/page_stack.t2003-03-06 18:22:04.0 +0100
@@ -1,6 +1,7 @@
 use warnings;
 use strict;
 use Test::More tests = 9;
+use t::Utils;
 
 BEGIN {
 use_ok( 'WWW::Mechanize' );
@@ -9,6 +10,9 @@
 my $t = WWW::Mechanize-new;
 isa_ok( $t, 'WWW::Mechanize', 'Created object' );
 
+SKIP: {
+skip Web does not seem to work, 7 unless 

RE: WWW::Mechanize 0.37 released

2003-03-05 Thread Tels
-BEGIN PGP SIGNED MESSAGE-

Moin,

On 04-Mar-03 Andy Lester carved into stone:
 There's a new version of WWW::Mechanize for you people who do automated 
 testing with it.  It adds a title() and is_html() method, and removes 
 the dependency on Clone, which I hope will fix stability issues on 
 Windows.

Damn. I still forgot to check out this incredible cool sounding module, I
have some HTML-output testing in a testsuite and it is very whacky and
uncomplete...

Thanx again for your work,

Tels

- -- 
 Signed on Wed Mar  5 17:52:44 2003 with http://bloodgate.com/tels.asc

 perl -MDev::Bollocks -le'print Dev::Bollocks-rand()'
 authoritatively synthesize internet infomediaries

 http://www.notcpa.org/  You have the freedom to run any code. Yet.
 http://bloodgate.com/perl   My current Perl projects

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.

iQEVAwUBPmYrXHcLPEOTuEwVAQH27Qf7BCfaaZirZE7A6rlqo46QQFotIhuxA7rr
5ws67TbcQ7GATJn6qLzdiN2lwYC3s/rj6TR9mFn8fy8+FNFLMUh2Xqdq6fqxLWkK
pvYpbRYu4ptClLOgfSf5pQKytnBDaVYavEKjdTcTgqa9fYCf8Muu5UMyzdmLLG1h
f8MS7LSvK47+MPnKwkybV5ohgq/7bZHraZ3pql4fGqoJK3JIp/31DCr0M8al5V11
ZCwv8uBY3FFIgnC/yMkgtr+vYH15MhKgJglq+rkumeu+umiyS+Ho59paAH0qpscI
UpBlXh4fZeRSIznOEgredFAIq7OriVHQvZ35CZr+cRdjFx92LSNLyA==
=1rop
-END PGP SIGNATURE-


Re: WWW::Mechanize 0.37 released

2003-03-05 Thread Andy Lester
Damn. I still forgot to check out this incredible cool sounding 
module, I
have some HTML-output testing in a testsuite and it is very whacky and
uncomplete...
I'd be glad to look at it, and see what kinds of things Mechanize can 
do.

xoa

--
Andy Lester, lead singer  driver of the Winnebago
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/


Re: WWW::Mechanize 0.37 released

2003-03-05 Thread Andy Lester
I installed it on a machine at work, and a large number of tests failed
because the machine has no access to the outside world.  Fixing that is
probably more effort than it is worth, but you might want to keep it in
mind for the next major rewrite.
There really aren't many tests that are meaningful without that access. 
 00.load.t, 99.pod and add_header.t are all that seem to be valid 
without it.

xoa

--
Andy Lester, lead singer  driver of the Winnebago
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/


Re: WWW::Mechanize 0.37 released

2003-03-05 Thread Robert Spier

 There really aren't many tests that are meaningful without that access. 
   00.load.t, 99.pod and add_header.t are all that seem to be valid 
 without it.

You could allow the user to choose between internal and external
tests, where the internal tests are much simpler, maybe including a
trivial self-contained webserver to make sure everything works.

-R


WWW::Mechanize 0.37 released

2003-03-04 Thread Andy Lester
There's a new version of WWW::Mechanize for you people who do automated 
testing with it.  It adds a title() and is_html() method, and removes 
the dependency on Clone, which I hope will fix stability issues on 
Windows.

xoa

--
Andy Lester, lead singer  driver of the Winnebago
[EMAIL PROTECTED], AIM:petdance
http://petdance.com/ http://use.perl.org/~petdance/