Source

perl/keyring/kdewallet / t / 07-ugly-chars.t

Diff from to

t/07-ugly-chars.t

 my $UGLY_PWD =  "«tajne hasło»";
 my $UGLY_REALM = '«do»–main';
 
-my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::KDEWallet::Keyring unit tests", group=>"Ugly chars");
+SKIP: {
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+    my $ring;
+    eval {
+        $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::KDEWallet::Keyring unit tests", group=>"Ugly chars");
+    }; if($@) {
+        if($@ =~ /^KWallet not available/) {
+            skip "KWallet not available ($@)", 4;
+        } else {
+            die $@;
+        }
+    }
 
-$ring->set_password($UGLY_NAME, $UGLY_PWD, $UGLY_REALM);
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
 
-ok( 1, "set_password with ugly chars works" );
+    $ring->set_password($UGLY_NAME, $UGLY_PWD, $UGLY_REALM);
 
-ok( $ring->get_password($UGLY_NAME, $UGLY_REALM) eq $UGLY_PWD, "get works with ugly characters");
+    ok( 1, "set_password with ugly chars works" );
 
-ok( $ring->clear_password($UGLY_NAME, $UGLY_REALM) eq 1, "clear clears");
+    ok( $ring->get_password($UGLY_NAME, $UGLY_REALM) eq $UGLY_PWD, "get works with ugly characters");
 
+    ok( $ring->clear_password($UGLY_NAME, $UGLY_REALM) eq 1, "clear clears");
+
+}