r61102 - in /branches/upstream/libauthen-bitcard-perl/current: ./ lib/Authen/ lib/Sau/ t/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Tue Aug 3 02:54:42 UTC 2010


Author: ansgar-guest
Date: Tue Aug  3 02:54:08 2010
New Revision: 61102

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=61102
Log:
[svn-upgrade] new version libauthen-bitcard-perl (0.89)

Added:
    branches/upstream/libauthen-bitcard-perl/current/dist.ini
    branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t
    branches/upstream/libauthen-bitcard-perl/current/t/11login.nt
    branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt
    branches/upstream/libauthen-bitcard-perl/current/t/14session.nt
    branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt
    branches/upstream/libauthen-bitcard-perl/current/t/coverage
    branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t
    branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t
    branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t
    branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t
Removed:
    branches/upstream/libauthen-bitcard-perl/current/NOTICE
    branches/upstream/libauthen-bitcard-perl/current/lib/Sau/
Modified:
    branches/upstream/libauthen-bitcard-perl/current/Changes
    branches/upstream/libauthen-bitcard-perl/current/LICENSE
    branches/upstream/libauthen-bitcard-perl/current/MANIFEST
    branches/upstream/libauthen-bitcard-perl/current/META.yml
    branches/upstream/libauthen-bitcard-perl/current/Makefile.PL
    branches/upstream/libauthen-bitcard-perl/current/README
    branches/upstream/libauthen-bitcard-perl/current/lib/Authen/Bitcard.pm

Modified: branches/upstream/libauthen-bitcard-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/Changes?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/Changes (original)
+++ branches/upstream/libauthen-bitcard-perl/current/Changes Tue Aug  3 02:54:08 2010
@@ -1,3 +1,10 @@
+
+0.89    August 2, 2010
+  - Use JSON instead of JSON::XS
+  - Use Digest::SHA instead of Digest::SHA1 (RT#59919, Ansgar Burchardt)
+  - Add add_invite method
+  - Various tweaks
+
 0.87 - September 14, 2009
   - Add Class::ErrorHandler to the prereqs list
   - Update documentation

Modified: branches/upstream/libauthen-bitcard-perl/current/LICENSE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/LICENSE?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/LICENSE (original)
+++ branches/upstream/libauthen-bitcard-perl/current/LICENSE Tue Aug  3 02:54:08 2010
@@ -1,3 +1,8 @@
+This software is Copyright (c) 2010 by Ask Bjørn Hansen.
+
+This is free software, licensed under:
+
+  The Apache License, Version 2.0, January 2004
 
                                  Apache License
                            Version 2.0, January 2004

Modified: branches/upstream/libauthen-bitcard-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/MANIFEST?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/MANIFEST (original)
+++ branches/upstream/libauthen-bitcard-perl/current/MANIFEST Tue Aug  3 02:54:08 2010
@@ -1,14 +1,22 @@
+Changes
+LICENSE
+MANIFEST
+META.yml
 Makefile.PL
-Changes
+README
+dist.ini
 lib/Authen/Bitcard.pm
-lib/Sau/Client.pm
-LICENSE
-Makefile.PL
-MANIFEST			This list of files
-META.yml
-NOTICE
-README
+t/00-compile.t
 t/10config.t
+t/11login.nt
 t/11verify.t
+t/12ticket.nt
 t/13podcoverage.t
+t/14session.nt
 t/15pod.t
+t/18attributes.nt
+t/coverage
+t/release-dist-manifest.t
+t/release-distmeta.t
+t/release-has-version.t
+t/release-pod-coverage.t

Modified: branches/upstream/libauthen-bitcard-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/META.yml?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/META.yml (original)
+++ branches/upstream/libauthen-bitcard-perl/current/META.yml Tue Aug  3 02:54:08 2010
@@ -1,27 +1,28 @@
---- #YAML:1.0
-name:               Authen-Bitcard
-version:            0.87
-abstract:           Bitcard authentication verification
+---
+abstract: 'Bitcard authentication verification'
 author:
-    - Ask Bjoern Hansen <ask at develooper.com>
-license:            unknown
-distribution_type:  module
+  - 'Ask Bjørn Hansen <ask at develooper.com>'
+build_requires:
+  Test::More: 0
 configure_requires:
-    ExtUtils::MakeMaker:  0
+  ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101670'
+license: apache
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Authen-Bitcard
 requires:
-    Class::ErrorHandler:  0
-    Digest::SHA1:         0
-    HTTP::Status:         0
-    LWP::UserAgent:       0
-    Math::BigInt:         0
-    MIME::Base64:         0
-    Test::More:           0
-    URI:                  1.22
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  Class::ErrorHandler: 0
+  Digest::SHA: 0
+  HTTP::Status: 0
+  JSON: 2.12
+  LWP::UserAgent: 0
+  MIME::Base64: 0
+  Math::BigInt: 0
+  URI: 1.22
+resources:
+  homepage: http://search.cpan.org/dist/Authen-Bitcard/
+  repository: http://git.develooper.com/bitcard-perl-api.git
+version: 0.89

Modified: branches/upstream/libauthen-bitcard-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/Makefile.PL?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/Makefile.PL (original)
+++ branches/upstream/libauthen-bitcard-perl/current/Makefile.PL Tue Aug  3 02:54:08 2010
@@ -1,24 +1,60 @@
+
 use strict;
 use warnings;
-use ExtUtils::MakeMaker;
 
-WriteMakefile(
-    NAME                => 'Authen::Bitcard',
-    AUTHOR              => 'Ask Bjoern Hansen <ask at develooper.com>',
-    VERSION_FROM        => 'lib/Authen/Bitcard.pm',
-    ABSTRACT_FROM       => 'lib/Authen/Bitcard.pm',
-    PL_FILES            => {},
-    PREREQ_PM => {
-                  'Test::More'     => 0,
-                  'Math::BigInt'   => 0,
-                  'MIME::Base64'   => 0,
-                  'Digest::SHA1'   => 0,
-                  'LWP::UserAgent' => 0,
-                  'HTTP::Status'   => 0,
-                  'URI'            => 1.22,
-                  'Class::ErrorHandler' => 0,
-    },
-    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+
+
+use ExtUtils::MakeMaker 6.31;
+
+
+
+my %WriteMakefileArgs = (
+  'ABSTRACT' => 'Bitcard authentication verification',
+  'AUTHOR' => 'Ask Bjørn Hansen <ask at develooper.com>',
+  'BUILD_REQUIRES' => {
+    'Test::More' => '0'
+  },
+  'CONFIGURE_REQUIRES' => {
+    'ExtUtils::MakeMaker' => '6.31'
+  },
+  'DISTNAME' => 'Authen-Bitcard',
+  'EXE_FILES' => [],
+  'LICENSE' => 'apache',
+  'NAME' => 'Authen::Bitcard',
+  'PREREQ_PM' => {
+    'Class::ErrorHandler' => '0',
+    'Digest::SHA' => '0',
+    'HTTP::Status' => '0',
+    'JSON' => '2.12',
+    'LWP::UserAgent' => '0',
+    'MIME::Base64' => '0',
+    'Math::BigInt' => '0',
+    'URI' => '1.22'
+  },
+  'VERSION' => '0.89',
+  'test' => {
+    'TESTS' => 't/*.t'
+  }
 );
 
 
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+  my $pp = $WriteMakefileArgs{PREREQ_PM};
+  for my $mod ( keys %$br ) {
+    if ( exists $pp->{$mod} ) {
+      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+    }
+    else {
+      $pp->{$mod} = $br->{$mod};
+    }
+  }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+

Modified: branches/upstream/libauthen-bitcard-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/README?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/README (original)
+++ branches/upstream/libauthen-bitcard-perl/current/README Tue Aug  3 02:54:08 2010
@@ -87,7 +87,8 @@
     If the signature is successfully verified, *verify* returns a reference
     to a hash containing the following values.
 
-    * id
+    *   id
+
         The unique user id of the Bitcard user on your site. It's a 128bit
         number as a 40 byte hex value.
 
@@ -95,16 +96,20 @@
         other user data fields are optional, see "info_required" and
         "info_optional").
 
-    * username
+    *   username
+
         The unique username of the Bitcard user.
 
-    * name
+    *   name
+
         The user's display name.
 
-    * email
+    *   email
+
         The user's email address.
 
-    * ts
+    *   ts
+
         The timestamp at which the signature was generated, expressed as
         seconds since the epoch.
 
@@ -145,12 +150,21 @@
     Get/set the version of the Bitcard protocol to use. The default version
     is 3.
 
+  $bc->api_secret( $secret )
+    Get/set the api_secret (needed for some API calls, add_invite for
+    example).
+
+  $bc->add_invite
+    Returns a hashref with "invite_url" and "invite_key". Can be used for
+    "invitation only" sites where you have to login before you can access
+    the site.
+
 LICENSE
-    *Authen::Bitcard* is free software; you may redistribute it and/or
-    modify it under the same terms as Perl itself.
+    *Authen::Bitcard* is distributed under the Apache License; see the
+    LICENSE file in the distribution for details.
 
 AUTHOR & COPYRIGHT
-    Except where otherwise noted, *Authen::Bitcard* is Copyright 2004-2006
+    Except where otherwise noted, *Authen::Bitcard* is Copyright 2004-2010
     Develooper LLC, ask at develooper.com.
 
     Parts are Copyright 2004 Six Apart Ltd, cpan at sixapart.com.

Added: branches/upstream/libauthen-bitcard-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/dist.ini?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/dist.ini (added)
+++ branches/upstream/libauthen-bitcard-perl/current/dist.ini Tue Aug  3 02:54:08 2010
@@ -1,0 +1,47 @@
+name    = Authen-Bitcard
+author  = Ask Bjørn Hansen <ask at develooper.com>
+license = Apache_2_0
+
+copyright_holder = Ask Bjørn Hansen
+# copyright_year   = 2004-2010
+
+[Prereqs]
+Math::BigInt   = 0
+MIME::Base64   = 0
+Digest::SHA    = 0
+LWP::UserAgent = 0
+HTTP::Status   = 0
+URI            = 1.22
+Class::ErrorHandler = 0
+JSON           = 2.12
+
+[Prereqs / TestRequires ]
+Test::More   = 0
+
+[@Git]
+# push_to    = all
+
+[@Filter]
+bundle = @Basic
+remove = Readme
+remove = Manifest
+
+[Repository]
+[Homepage]
+
+[BumpVersionFromGit]
+
+[PkgVersion]
+
+[CheckChangeLog]
+[CompileTests]
+[DistManifestTests]
+[HasVersionTests]
+[MetaTests]
+[ReadmeFromPod]
+[PodCoverageTests]
+[Manifest]
+
+[NextRelease]
+format = %-7v %{MMMM d, yyyy}d
+

Modified: branches/upstream/libauthen-bitcard-perl/current/lib/Authen/Bitcard.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/lib/Authen/Bitcard.pm?rev=61102&op=diff
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/lib/Authen/Bitcard.pm (original)
+++ branches/upstream/libauthen-bitcard-perl/current/lib/Authen/Bitcard.pm Tue Aug  3 02:54:08 2010
@@ -1,16 +1,19 @@
 package Authen::Bitcard;
+BEGIN {
+  $Authen::Bitcard::VERSION = '0.89';
+}
 use strict;
 use base qw( Class::ErrorHandler );
 
-use Math::BigInt lib => 'GMP,Pari';
+use Math::BigInt;
 use MIME::Base64 qw( decode_base64 );
-use Digest::SHA1 qw( sha1 );
+use Digest::SHA qw( sha1 sha1_hex );
 use LWP::UserAgent;
 use HTTP::Status qw( RC_NOT_MODIFIED );
 use URI;
 use URI::QueryParam;
-
-our $VERSION = '0.87';
+use Carp qw(croak);
+use JSON qw(decode_json);
 
 sub new {
     my $class = shift;
@@ -39,6 +42,7 @@
 sub skip_expiry_check { shift->_var('skip_expiry_check', @_) }
 sub expires           { shift->_var('expires',           @_) }
 sub token             { shift->_var('token',             @_) }
+sub api_secret        { shift->_var('api_secret',        @_) }
 sub version           { shift->_var('version',           @_) }
 sub ua                { shift->_var('ua',                @_) }
 sub bitcard_url       { shift->_var('bitcard_url',       @_) }
@@ -58,7 +62,18 @@
   my $base = $bc->bitcard_url;
   $base = "$base/" unless $base =~ m!/$!;
   my $uri = URI->new($base . $url);
-  $uri->query_form_hash($args) unless $url =~ m/regkey.txt/;;
+  unless ($url =~ m/regkey.txt/) {
+      if ($url =~ m!^api/!) {
+          croak "Bitcard API Secret required for API calls" unless $bc->api_secret;
+          $args->{bc_ts} = time;
+          my @fields = sort keys %$args;
+          $args->{bc_fields} = join ",", @fields, 'bc_fields';
+          my $string = join "::", (map { "$args->{$_}" } @fields, 'bc_fields'), $bc->api_secret;
+          warn "ST: $string";
+          $args->{bc_sig} = sha1_hex($string);
+      }
+      $uri->query_form_hash($args);
+  }
   $uri->as_string;
 }
 
@@ -81,6 +96,12 @@
 sub register_url {
   shift->_url('register', @_)
 }
+
+sub _api_url {
+  my ($self, $method) = (shift, shift);
+  $self->_url("api/$method", @_);
+}
+
 
 sub verify {
     my $bc = shift;
@@ -154,6 +175,10 @@
     $u1 == $sig->{r};
 }
 
+sub _get_ua {
+    shift->ua || LWP::UserAgent->new;
+}
+
 sub _fetch_key {
     my $bc = shift;
     my($uri) = @_;
@@ -162,7 +187,7 @@
     return $cache->($bc, $uri) if $cache && ref($cache) eq 'CODE';
     ## Otherwise, load the key.
     my $data;
-    my $ua = $bc->ua || LWP::UserAgent->new;
+    my $ua = $bc->_get_ua;
     if ($cache) {
         my $res = $ua->mirror($uri, $cache);
         return $bc->error("Failed to fetch key: " . $res->status_line)
@@ -186,6 +211,17 @@
     $key;
 }
 
+sub add_invite {
+    my $self  = shift;
+    my $url = $self->_api_url('invite/add_invite', @_);
+    warn "URL: $url\n";
+    my $res = $self->_get_ua->get($url);
+    return $self->error("Failed to retrive invitation code: " . $res->status_line)
+      unless $res->is_success;
+    my $data = decode_json($res->content);
+    $data;
+}
+
 1;
 __END__
 
@@ -367,15 +403,27 @@
 Get/set the version of the Bitcard protocol to use. The default version
 is C<3>.
 
+=head2 $bc->api_secret( $secret )
+
+Get/set the api_secret (needed for some API calls, add_invite for
+example).
+
+=head2 $bc->add_invite
+
+Returns a hashref with C<invite_url> and C<invite_key>.  Can be used
+for "invitation only" sites where you have to login before you can
+access the site.
+
+
 =head1 LICENSE
 
-I<Authen::Bitcard> is free software; you may redistribute it and/or modify it
-under the same terms as Perl itself.
+I<Authen::Bitcard> is distributed under the Apache License; see the
+LICENSE file in the distribution for details.
 
 =head1 AUTHOR & COPYRIGHT
 
 Except where otherwise noted, I<Authen::Bitcard> is Copyright
-2004-2006 Develooper LLC, ask at develooper.com.
+2004-2010 Develooper LLC, ask at develooper.com.
 
 Parts are Copyright 2004 Six Apart Ltd, cpan at sixapart.com.
 

Added: branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t Tue Aug  3 02:54:08 2010
@@ -1,0 +1,45 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+use File::Find;
+use File::Temp qw{ tempdir };
+
+my @modules;
+find(
+  sub {
+    return if $File::Find::name !~ /\.pm\z/;
+    my $found = $File::Find::name;
+    $found =~ s{^lib/}{};
+    $found =~ s{[/\\]}{::}g;
+    $found =~ s/\.pm$//;
+    # nothing to skip
+    push @modules, $found;
+  },
+  'lib',
+);
+
+my @scripts = glob "bin/*";
+
+my $plan = scalar(@modules) + scalar(@scripts);
+$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
+
+{
+    # fake home for cpan-testers
+    # no fake requested ## local $ENV{HOME} = tempdir( CLEANUP => 1 );
+
+    like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" )
+        for sort @modules;
+
+    SKIP: {
+        eval "use Test::Script 1.05; 1;";
+        skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
+        foreach my $file ( @scripts ) {
+            my $script = $file;
+            $script =~ s!.*/!!;
+            script_compiles( $file, "$script script compiles" );
+        }
+    }
+}

Added: branches/upstream/libauthen-bitcard-perl/current/t/11login.nt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/11login.nt?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/11login.nt (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/11login.nt Tue Aug  3 02:54:08 2010
@@ -1,0 +1,45 @@
+use Test::More tests => 12;
+use strict;
+use warnings;
+use lib 't';
+use_ok('Authen::Bitcard');
+use Test::AuthClient;
+use Test::WWW::Mechanize;
+
+ok(Authen::Bitcard->set_config(Test::AuthClient->config_args), 'set config');
+
+ok(my $auth = Authen::Bitcard->new(), "new");
+
+my $agent = Test::WWW::Mechanize->new();
+$agent->get($auth->login_url);
+ok($agent->success, "got login page");
+$agent->form_name('login');
+$agent->field('login', 'test');
+$agent->field('password', 'foo');
+$agent->click;
+my $uri = URI::URL->new($agent->uri);
+
+is($uri->host, "authtest.askask.com", "we got sent to authtest");
+
+#if(open F, ">/home/ask/public_html/tmp/a1.html") {
+#  print F $agent->content;
+#  close F;
+#}
+
+my (%q) = $uri->query_form;
+ok($q{t}, "got ticket");
+ok($auth = Authen::Bitcard->new(t => $q{t}), "new authclient, with ticket");
+ok($auth->delete_session, "delete session right away");
+
+my $return_url = "http://authtest.askask.com/?test=logout";
+$agent->get($auth->logout_url("return_url" => $return_url));
+$agent->follow_link( text_regex => qr/Continue/i );
+ok($agent->success, 'got logout page');
+is($agent->uri, $return_url, "landed at the right page"); 
+
+my $url = $auth->login_url(info_request => "email");
+like($url, qr/i=email/, 'login_url(info_request => "email")'); 
+$url = $auth->login_url(info_request => ['username','email']);
+like($url, qr/i=username(,|\%2C)email/, 'login_url(info_request => [array])'); 
+
+

Added: branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt Tue Aug  3 02:54:08 2010
@@ -1,0 +1,51 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+use lib 't';
+use_ok('Authen::Bitcard');
+use Test::AuthClient;
+use Test::WWW::Mechanize;
+
+my $agent = Test::WWW::Mechanize->new();
+
+ok(Authen::Bitcard->set_config(Test::AuthClient->config_args), 'set config');
+
+ok(my $auth = Authen::Bitcard->new(), "new");
+
+$agent->get($auth->login_url);
+ok($agent->success, "got login page");
+$agent->set_visible('test', 'foo');
+$agent->click;
+
+my %q = URI::URL->new($agent->uri)->query_form;
+ok($q{t}, "got ticket");
+
+# simulate new request to the site server ...
+
+ok($auth = Authen::Bitcard->new(ticket => $q{t}), "new authclient, with ticket");
+ok($auth->is_authenticated, "is_authenticated");
+ok($auth->user_id, "user_id"); 
+is($auth->username, "test", "username"); 
+ok($auth->email, "email");
+ok(my $session_id = $auth->session_id, "get session_id");
+
+# new request with the session_id
+ok($auth = Authen::Bitcard->new(session_id => $session_id), "new authclient, with session_id");
+is($auth->username, "test", "username is still test with session_id"); 
+
+ok(sleep 2, "sleep 2 seconds");
+ok($auth->data_age >= 2, "data_age 2 seconds or older");
+
+ok($auth->force_refresh(1), "force_refresh");
+ok($auth->data_age < 2, "data_age less than 2 seconds");
+
+ok($auth->delete_session, "delete session");
+is($auth->data_age, undef, "data_age undef without a session");
+
+my $return_url = "http://authtest.askask.com/?test=logout";
+$agent->get($auth->logout_url("return_url" => $return_url));
+ok($agent->success, 'got logout page');
+$agent->follow_link( text_regex => qr/Continue/i );
+is($agent->uri, $return_url, "landed at the right page"); 
+
+

Added: branches/upstream/libauthen-bitcard-perl/current/t/14session.nt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/14session.nt?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/14session.nt (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/14session.nt Tue Aug  3 02:54:08 2010
@@ -1,0 +1,20 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+use lib 't';
+use_ok('Authen::Bitcard');
+use Test::AuthClient;
+
+# For now just testing non-working sessions here, the real session tests are in 12tickets.t
+
+ok(Authen::Bitcard->set_config(Test::AuthClient->config_args), 'set config');
+
+ok(my $auth = Authen::Bitcard->new(session_id => "1234"), "new authclient, with non existing session_id");
+ok(!$auth->is_authenticated, "isn't authenticated");
+is($auth->username, "", "no session, no user_id"); 
+is($auth->session_id, "", "invalid session_id makes auth->session_id return emptry string");
+
+
+ok($auth = Authen::Bitcard->new(session_id => '44574810595a34b3c7dd5ba602a2366bea9166f3'), 'foo');
+ 
+

Added: branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt Tue Aug  3 02:54:08 2010
@@ -1,0 +1,41 @@
+use Test::More qw(no_plan);
+use strict;
+use warnings;
+use lib 't';
+use_ok('Authen::Bitcard');
+use Test::AuthClient;
+use Test::WWW::Mechanize;
+
+my $agent = Test::WWW::Mechanize->new();
+
+ok(Authen::Bitcard->set_config(Test::AuthClient->config_args), 'set config');
+
+ok(my $auth = Authen::Bitcard->new(), "new");
+
+$agent->get($auth->login_url);
+ok($agent->success, "got login page");
+$agent->set_visible('test', 'foo');
+$agent->click;
+
+my %q = URI::URL->new($agent->uri)->query_form;
+ok($q{t}, "got ticket");
+
+# simulate new request to the site server ...
+
+ok($auth = Authen::Bitcard->new(ticket => $q{t}), "new authclient, with ticket");
+ok($auth->is_authenticated, "is_authenticated");
+
+ok(my $session_id = $auth->session_id, "get session_id");
+
+## new request with the session_id
+#ok($auth = Authen::Bitcard->new(session_id => $session_id), "new authclient, with session_id");
+
+my $attribute = "foobar";
+ok($auth->set_attribute("test" => $attribute), "set_attribute");
+is($auth->get_attribute("test", "get_attribute"), $attribute, "get_attribute");
+
+ok($auth->delete_session, "delete session");
+
+# cleanup the session on the auth server
+my $return_url = "http://authtest.askask.com/?test=logout";
+$agent->get($auth->logout_url("return_url" => $return_url));

Added: branches/upstream/libauthen-bitcard-perl/current/t/coverage
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/coverage?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/coverage (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/coverage Tue Aug  3 02:54:08 2010
@@ -1,0 +1,7 @@
+/home/perl/bin/cover -delete;
+PERL5OPT=-MDevel::Cover=-ignore,Build perl Build test 
+/home/perl/bin/cover -report html -outputdir /home/ask/public_html/tmp/coverage 
+
+# http://one.develooper.com/~ask/tmp/coverage/
+
+

Added: branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t Tue Aug  3 02:54:08 2010
@@ -1,0 +1,16 @@
+#!perl
+
+BEGIN {
+  unless ($ENV{RELEASE_TESTING}) {
+    require Test::More;
+    Test::More::plan(skip_all => 'these tests are for release candidate testing');
+  }
+}
+
+
+use Test::More;
+
+eval "use Test::DistManifest";
+plan skip_all => "Test::DistManifest required for testing the manifest"
+  if $@;
+manifest_ok();

Added: branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t Tue Aug  3 02:54:08 2010
@@ -1,0 +1,15 @@
+#!perl
+
+BEGIN {
+  unless ($ENV{RELEASE_TESTING}) {
+    require Test::More;
+    Test::More::plan(skip_all => 'these tests are for release candidate testing');
+  }
+}
+
+
+use Test::More;
+
+eval "use Test::CPAN::Meta";
+plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
+meta_yaml_ok();

Added: branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t Tue Aug  3 02:54:08 2010
@@ -1,0 +1,16 @@
+#!perl
+
+BEGIN {
+  unless ($ENV{RELEASE_TESTING}) {
+    require Test::More;
+    Test::More::plan(skip_all => 'these tests are for release candidate testing');
+  }
+}
+
+
+use Test::More;
+
+eval "use Test::HasVersion";
+plan skip_all => "Test::HasVersion required for testing version numbers"
+  if $@;
+all_pm_version_ok();

Added: branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t?rev=61102&op=file
==============================================================================
--- branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t (added)
+++ branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t Tue Aug  3 02:54:08 2010
@@ -1,0 +1,21 @@
+#!perl
+
+BEGIN {
+  unless ($ENV{RELEASE_TESTING}) {
+    require Test::More;
+    Test::More::plan(skip_all => 'these tests are for release candidate testing');
+  }
+}
+
+
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.08";
+plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
+  if $@;
+
+eval "use Pod::Coverage::TrustPod";
+plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
+  if $@;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });




More information about the Pkg-perl-cvs-commits mailing list