summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kröll <pepl@cpan.org>2008-12-01 21:45:00 +0100
committerMichael Kröll <pepl@cpan.org>2008-12-01 21:45:00 +0100
commit8df59d9724c341f361b567b855aacc44543680d6 (patch)
tree0f33f3a98fcdca276bf52761dd84dba2da97303d
parentForgotten to add with last commit (diff)
parentMerge branch 'master' of git@git.useperl.at:PAUSE-OpenID (diff)
downloadSimple-OpenID-8df59d9724c341f361b567b855aacc44543680d6.tar.gz
Simple-OpenID-8df59d9724c341f361b567b855aacc44543680d6.tar.bz2
Simple-OpenID-8df59d9724c341f361b567b855aacc44543680d6.zip
Merge branch 'master' of git@git.useperl.at:PAUSE-OpenID
-rw-r--r--t/01-login.t54
1 files changed, 54 insertions, 0 deletions
diff --git a/t/01-login.t b/t/01-login.t
new file mode 100644
index 0000000..d15cef2
--- /dev/null
+++ b/t/01-login.t
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+#use Test::More 'no_plan';
+use Test::More tests => 4;
+use Test::WWW::Mechanize;
+#use WWW::Mechanize::Plugin::AutoWrite;
+
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+my $url = $ENV{'PAUSE_OpenID_url'} || 'http://localhost:3000/openid/';
+
+exit main();
+
+sub main {
+ my $mech = Test::WWW::Mechanize->new;
+ #$mech->autowrite('/tmp/mech.html');
+ $mech->get_ok($url) or exit(1);
+
+ my $uid = 'nonexisting';
+ my $pass = 'nonexisting';
+
+ my $res = $mech->submit_form(
+ 'form_number' => 1,
+ 'fields' => {
+ 'user' => $uid,
+ 'pass' => $pass,
+ },
+ );
+ is($res->code, 404, 'check failed login');
+
+ $uid = $ENV{'PAUSE_OpenID_uid'};
+ $pass = $ENV{'PAUSE_OpenID_pass'};
+
+ SKIP: {
+ skip('set PAUSE_OpenID_uid and PAUSE_OpenID_pass to test the successful login', 2)
+ if ((not $uid) or (not $pass));
+
+ $mech->get_ok($url);
+ my $res = $mech->submit_form(
+ 'with_fields' => {
+ 'user' => $uid,
+ 'pass' => $pass,
+ },
+ );
+ is($res->code, 200, 'check passed login');
+ }
+
+ return 0;
+}
+