Commits

Anonymous committed 635a6c9

Fixed some test failures (report http://www.cpantesters.org/cpan/report/fc20adfe-2ed3-11e2-ac21-d85600c29a28).
Failure reasons: unneeded import of Test::Exception, lack of conditonals for keyring persistence.

Comments (0)

Files changed (4)

t/01-set-and-get.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 6;
+use Test::More tests => 6;
 
 use Passwd::Keyring::Auto qw(get_keyring);
 
 my $ring = get_keyring(app_name=>"Passwd::Keyring::Auto unit tests", group=>"test 0");
+diag("Using " . ref($ring) . " keyring");
 
 ok( defined($ring),   'get_keyring() works' );
 

t/03-recovering-in-sep-prog.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 13;
+use Test::More tests => 13;
 
 use Passwd::Keyring::Auto qw(get_keyring);
 
 
 ok( defined($ring),   'get_keyring() works' );
 
-ok( ! defined($ring->get_password("Paul", $SOME_REALM)), "get works");
+ok( ! defined($ring->get_password("Paul", $SOME_REALM)), "get do not find phantoms");
 
-ok( $ring->get_password("Gregory", $SOME_REALM) eq 'secret-Greg', "get works");
+SKIP: {
+    skip "Using non-persistent keyring", 11 unless $ring->is_persistent;
 
-ok( $ring->get_password("Paul", $OTHER_REALM) eq 'secret-Paul2', "get works");
+    ok( $ring->get_password("Gregory", $SOME_REALM) eq 'secret-Greg', "get works");
 
-ok( $ring->get_password("Duke", $SOME_REALM) eq 'secret-Duke', "get works");
+    ok( $ring->get_password("Paul", $OTHER_REALM) eq 'secret-Paul2', "get works");
 
-ok( $ring->clear_password("Gregory", $SOME_REALM) eq 1, "clear clears");
+    ok( $ring->get_password("Duke", $SOME_REALM) eq 'secret-Duke', "get works");
 
-ok( ! defined($ring->get_password("Gregory", $SOME_REALM)), "clear cleared");
+    ok( $ring->clear_password("Gregory", $SOME_REALM) eq 1, "clear clears");
 
-ok( $ring->get_password("Paul", $OTHER_REALM) eq 'secret-Paul2', "get works");
+    ok( ! defined($ring->get_password("Gregory", $SOME_REALM)), "clear cleared");
 
-ok( $ring->get_password("Duke", $SOME_REALM) eq 'secret-Duke', "get works");
+    ok( $ring->get_password("Paul", $OTHER_REALM) eq 'secret-Paul2', "get works");
 
-ok( $ring->clear_password("Paul", $OTHER_REALM) eq 1, "clear clears");
+    ok( $ring->get_password("Duke", $SOME_REALM) eq 'secret-Duke', "get works");
 
-ok( $ring->clear_password("Duke", $SOME_REALM) eq 1, "clear clears");
+    ok( $ring->clear_password("Paul", $OTHER_REALM) eq 1, "clear clears");
 
-ok( ! defined($ring->get_password("Paul", $SOME_REALM)), "clear cleared");
-ok( ! defined($ring->get_password("Duke", $SOME_REALM)), "clear cleared");
+    ok( $ring->clear_password("Duke", $SOME_REALM) eq 1, "clear clears");
 
+    ok( ! defined($ring->get_password("Paul", $SOME_REALM)), "clear cleared");
+    ok( ! defined($ring->get_password("Duke", $SOME_REALM)), "clear cleared");
+}
 
 

t/21-finds_proper_keyring.t

 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
 
 BEGIN { use_ok("Passwd::Keyring::Auto", qw(get_keyring)) };
 

t/50-keyring_ops.t

 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
 
 BEGIN { use_ok("Passwd::Keyring::Auto"); }
 
     }
 
     my $keyring2 = Passwd::Keyring::Auto::get_keyring(app_name=>"Passwd::Keyring::Auto unit tests", group=>"test 50");
-    foreach my $idx (0 .. $#users) {
-        if($keyring2->is_persistent) {
-            ok( $pwds[$idx] eq $keyring2->get_password($users[$idx], $app));
-        } else {
+
+    is(ref($keyring2), ref($keyring1), "Got the same keyring on second invocation");
+
+  SKIP: {
+
+        skip "Using non-persistent keyring" unless $keyring2->is_persistent;
+
+        foreach my $idx (0 .. $#users) {
+            if($keyring2->is_persistent) {
+                ok( $pwds[$idx] eq $keyring2->get_password($users[$idx], $app));
+            } else {
+                ok( ! defined($keyring2->get_password($users[$idx], $app)));
+            }
+        }
+
+        $keyring1->clear_password($_, $app) foreach @users;
+        foreach my $idx (0 .. $#users) {
             ok( ! defined($keyring2->get_password($users[$idx], $app)));
         }
-    }
-
-    $keyring1->clear_password($_, $app) foreach @users;
-    foreach my $idx (0 .. $#users) {
-        ok( ! defined($keyring2->get_password($users[$idx], $app)));
+        
     }
 
 }