Anonymous avatar Anonymous committed 3c52eda

Syncing tests with gnome version

Comments (0)

Files changed (13)

-Revision history for Keyring-Gnome
+Revision history for Passwd::Keyring::KDEWallet
 
 0.01    Date/time
         First version, released on an unsuspecting world.
 .lwpcookies
 cover_db
 pod2htm*.tmp
-Passwd-Keyring-Gnome-*
+Passwd-Keyring-KDEWallet-*

t/01-set-and-get.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 3;
+use Test::Simple tests => 5;
 
 use Passwd::Keyring::KDEWallet;
 
 
 ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
 
-$ring->set_password("John", "secret", 'my@@domain');
-#$ring->set_password("John", "secret", 'my@@domain');
-#$ring->set_password("John", "secret", 'my@@domain');
+my $USER = 'John';
+my $PASSWORD = 'verysecret';
+
+$ring->set_password($USER, $PASSWORD, 'my@@domain');
 
 ok( 1, "set_password works" );
 
-ok( $ring->get_password("John", 'my@@domain') eq 'secret', "get works");
+ok( $ring->get_password($USER, 'my@@domain') eq $PASSWORD, "get recovers");
 
+ok( $ring->clear_password($USER, 'my@@domain') eq 1, "clear_password removed one password" );
+
+ok( !defined($ring->get_password($USER, 'my@@domain')), "no password after clear");

t/02-is-persistent.t

+#!perl -T
+
+use strict;
+use warnings;
+use Test::Simple tests => 2;
+
+use Passwd::Keyring::KDEWallet;
+
+my $ring = Passwd::Keyring::KDEWallet->new;
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+ok( $ring->is_persistent eq 1, "is_persistent knows we are persistent");
+

t/02-many-sets-and-gets.t

-#!perl -T
-
-use strict;
-use warnings;
-use Test::Simple tests => 11;
-
-use Passwd::Keyring::KDEWallet;
-
-my $ring = Passwd::Keyring::KDEWallet->new;
-
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
-
-$ring->set_password("Paul", "secret-Paul", 'my@@domain');
-$ring->set_password("Gregory", "secret-Greg", 'my@@domain');#
-$ring->set_password("Paul", "secret-Paul2", 'other@@domain');
-$ring->set_password("Duke", "secret-Duke", 'my@@domain');
-
-ok( 1, "set_password works" );
-
-ok( $ring->get_password("Paul", 'my@@domain') eq 'secret-Paul', "get works");
-
-ok( $ring->get_password("Gregory", 'my@@domain') eq 'secret-Greg', "get works");
-
-ok( $ring->get_password("Paul", 'other@@domain') eq 'secret-Paul2', "get works");
-
-ok( $ring->get_password("Duke", 'my@@domain') eq 'secret-Duke', "get works");
-
-$ring->clear_password("Paul", 'my@@domain');
-ok(1, "clear_password works");
-
-ok( ! defined($ring->get_password("Paul", 'my@@domain')), "get works");
-
-ok( $ring->get_password("Gregory", 'my@@domain') eq 'secret-Greg', "get works");
-
-ok( $ring->get_password("Paul", 'other@@domain') eq 'secret-Paul2', "get works");
-
-ok( $ring->get_password("Duke", 'my@@domain') eq 'secret-Duke', "get works");
-
-

t/03-many-sets-and-gets.t

+#!perl -T
+
+use strict;
+use warnings;
+use Test::Simple tests => 11;
+
+use Passwd::Keyring::KDEWallet;
+
+my $PSEUDO_DOMAIN = 'my@@domain';
+my $OTHER_DOMAIN = 'other domain';
+
+my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::KDEWallet", group=>"Unit tests");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+$ring->set_password("Paul", "secret-Paul", $PSEUDO_DOMAIN);
+$ring->set_password("Gregory", "secret-Greg", $PSEUDO_DOMAIN);#
+$ring->set_password("Paul", "secret-Paul2", $OTHER_DOMAIN);
+$ring->set_password("Duke", "secret-Duke", $PSEUDO_DOMAIN);
+
+ok( 1, "set_password works" );
+
+ok( $ring->get_password("Paul", $PSEUDO_DOMAIN) eq 'secret-Paul', "get works");
+
+ok( $ring->get_password("Gregory", $PSEUDO_DOMAIN) eq 'secret-Greg', "get works");
+
+ok( $ring->get_password("Paul", $OTHER_DOMAIN) eq 'secret-Paul2', "get works");
+
+ok( $ring->get_password("Duke", $PSEUDO_DOMAIN) eq 'secret-Duke', "get works");
+
+ok( $ring->clear_password("Paul", $PSEUDO_DOMAIN) eq 1, "clear_password removed 1");
+
+ok( ! defined($ring->get_password("Paul", $PSEUDO_DOMAIN)), "get works");
+
+ok( $ring->get_password("Gregory", $PSEUDO_DOMAIN) eq 'secret-Greg', "get works");
+
+ok( $ring->get_password("Paul", $OTHER_DOMAIN) eq 'secret-Paul2', "get works");
+
+ok( $ring->get_password("Duke", $PSEUDO_DOMAIN) eq 'secret-Duke', "get works");
+
+
+# Note: cleanup is performed by test 04, we test passing data to
+#       separate program.

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

-#!perl -T
-
-use strict;
-use warnings;
-use Test::Simple tests => 5;
-
-use Passwd::Keyring::KDEWallet;
-
-my $ring = Passwd::Keyring::KDEWallet->new;
-
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
-
-ok( ! defined($ring->get_password("Paul", 'my@@domain')), "get works");
-
-ok( $ring->get_password("Gregory", 'my@@domain') eq 'secret-Greg', "get works");
-
-ok( $ring->get_password("Paul", 'other@@domain') eq 'secret-Paul2', "get works");
-
-ok( $ring->get_password("Duke", 'my@@domain') eq 'secret-Duke', "get works");
-
-

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

+#!perl -T
+
+use strict;
+use warnings;
+use Test::Simple tests => 13;
+
+use Passwd::Keyring::KDEWallet;
+
+my $PSEUDO_DOMAIN = 'my@@domain';
+my $OTHER_DOMAIN = 'other domain';
+
+my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::KDEWallet", group=>"Unit tests");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+ok( ! defined($ring->get_password("Paul", $PSEUDO_DOMAIN)), "get works");
+
+ok( $ring->get_password("Gregory", $PSEUDO_DOMAIN) eq 'secret-Greg', "get works");
+
+ok( $ring->get_password("Paul", $OTHER_DOMAIN) eq 'secret-Paul2', "get works");
+
+ok( $ring->get_password("Duke", $PSEUDO_DOMAIN) eq 'secret-Duke', "get works");
+
+ok( $ring->clear_password("Gregory", $PSEUDO_DOMAIN) eq 1, "clear clears");
+
+ok( ! defined($ring->get_password("Gregory", $PSEUDO_DOMAIN)), "clear cleared");
+
+ok( $ring->get_password("Paul", $OTHER_DOMAIN) eq 'secret-Paul2', "get works");
+
+ok( $ring->get_password("Duke", $PSEUDO_DOMAIN) eq 'secret-Duke', "get works");
+
+ok( $ring->clear_password("Paul", $OTHER_DOMAIN) eq 1, "clear clears");
+
+ok( $ring->clear_password("Duke", $PSEUDO_DOMAIN) eq 1, "clear clears");
+
+ok( ! defined($ring->get_password("Paul", $PSEUDO_DOMAIN)), "clear cleared");
+ok( ! defined($ring->get_password("Duke", $PSEUDO_DOMAIN)), "clear cleared");
+
+
+

t/05-many-sets-and-gets-with-name.t

+#!perl -T
+
+use strict;
+use warnings;
+use Test::Simple tests => 20;
+
+use Passwd::Keyring::KDEWallet;
+
+my $DOMAIN_A = 'my@@domain';
+my $DOMAIN_B = 'bum trala la';
+my $DOMAIN_C = 'other domain';
+
+my $USER1 = "Paul Anton";
+my $USER2 = "Gżegąź";
+my $USER4 = "-la-san-ty-";
+
+my $PWD1 = "secret-Paul";
+my $PWD1_ALT = "secret-Paul2 ąąąą";
+my $PWD2 = "secret-Greg";
+my $PWD4 = "secret-Duke";
+
+my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::KDEWallet", group=>"Unit tests (secrets)");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+$ring->set_password($USER1, $PWD1, $DOMAIN_B);
+$ring->set_password($USER2, $PWD2, $DOMAIN_B);#
+$ring->set_password($USER1, $PWD1_ALT, $DOMAIN_C);
+$ring->set_password($USER4, $PWD4, $DOMAIN_B);
+
+ok( 1, "set_password works" );
+
+ok( $ring->get_password($USER1, $DOMAIN_B) eq $PWD1, "get works");
+
+ok( $ring->get_password($USER2, $DOMAIN_B) eq $PWD2, "get works");
+
+ok( $ring->get_password($USER1, $DOMAIN_C) eq $PWD1_ALT, "get works");
+
+ok( $ring->get_password($USER4, $DOMAIN_B) eq $PWD4, "get works");
+
+$ring->clear_password($USER1, $DOMAIN_B);
+ok(1, "clear_password works");
+
+ok( ! defined($ring->get_password($USER1, $DOMAIN_A)), "get works");
+
+ok( ! defined($ring->get_password($USER2, $DOMAIN_A)), "get works");
+
+ok( $ring->get_password($USER2, $DOMAIN_B) eq $PWD2, "get works");
+
+ok( $ring->get_password($USER1, $DOMAIN_C) eq $PWD1_ALT, "get works");
+
+ok( $ring->get_password($USER4, $DOMAIN_B) eq $PWD4, "get works");
+
+ok( $ring->clear_password($USER2, $DOMAIN_B) eq 1, "clear clears");
+
+ok( ! defined($ring->get_password($USER2, $DOMAIN_A)), "clear cleared");
+
+ok( $ring->get_password($USER1, $DOMAIN_C) eq $PWD1_ALT, "get works");
+
+ok( $ring->get_password($USER4, $DOMAIN_B) eq $PWD4, "get works");
+
+ok( $ring->clear_password($USER1, $DOMAIN_C) eq 1, "clear clears");
+
+ok( $ring->clear_password($USER4, $DOMAIN_B) eq 1, "clear clears");
+
+ok( ! defined($ring->get_password($USER1, $DOMAIN_C)), "clear cleared");
+ok( ! defined($ring->get_password($USER4, $DOMAIN_B)), "clear cleared");
+
+
+
+
+

t/06-recovering-with-app-change.t

+#!perl -T
+
+use strict;
+use warnings;
+#use Test::More tests => 11;
+use Test::More skip_all => "Currently app and group are meaningful. To be decided whether to keep this behaviour";
+
+use Passwd::Keyring::KDEWallet;
+
+my $USER = "Herakliusz";
+my $DOMAIN = "test domain";
+my $PWD = "arcytajne haslo";
+
+my $orig_ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::Unit tests", group=>"Yet so");
+
+ok( defined($orig_ring) && ref $orig_ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+ok( ! defined($orig_ring->get_password($USER, $DOMAIN)), "initially unset");
+
+$orig_ring->set_password($USER, $PWD, $DOMAIN);
+ok(1, "set password");
+
+ok( $orig_ring->get_password($USER, $DOMAIN) eq $PWD, "normal get works");
+
+
+# Another object with the same app/group
+
+my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::Unit tests", group=>"Yet so");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet', 'second new() works' );
+
+ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get from another ring with the same data works");
+
+# Only group changes
+
+$ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::Keyring::Unit tests", group=>"It has changed");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet', 'third new() works' );
+
+ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get from another ring with different group works");
+
+# App and group change
+
+$ring = Passwd::Keyring::KDEWallet->new(app=>"Something else", group=>"Yet Yet so");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet', 'fourth new() works' );
+
+ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get from another ring with changed app and group works");
+
+
+# Cleanup
+ok( $orig_ring->clear_password($USER, $DOMAIN) eq 1, "clearing");
+

t/07-ugly-chars.t

+#!perl -T
+
+use strict;
+use warnings;
+use Test::Simple tests => 4;
+
+use Passwd::Keyring::KDEWallet;
+
+my $UGLY_NAME = "Joh ## no ^^ »ąćęłóśż«";
+my $UGLY_PWD =  "«tajne hasło»";
+my $UGLY_DOMAIN = '«do»–main';
+
+my $ring = Passwd::Keyring::KDEWallet->new(app=>"Passwd::KDEWallet::Keyring unit tests", group=>"Ugly chars");
+
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
+
+$ring->set_password($UGLY_NAME, $UGLY_PWD, $UGLY_DOMAIN);
+
+ok( 1, "set_password with ugly chars works" );
+
+ok( $ring->get_password($UGLY_NAME, $UGLY_DOMAIN) eq $UGLY_PWD, "get works with ugly characters");
+
+ok( $ring->clear_password($UGLY_NAME, $UGLY_DOMAIN) eq 1, "clear clears");
+

t/99-cleanup.t

-#!perl -T
-
-use strict;
-use warnings;
-use Test::Simple tests => 8;
-
-use Passwd::Keyring::KDEWallet;
-
-my $ring = Passwd::Keyring::KDEWallet->new;
-
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::KDEWallet',   'new() works' );
-
-$ring->clear_password("Paul", 'my@@domain');
-ok(1, "clear_password works");
-
-ok( $ring->clear_password("Gregory", 'my@@domain'));
-ok(1, "clear_password works");
-
-ok( $ring->clear_password("Paul", 'other@@domain'));
-ok(1, "clear_password works");
-
-ok( $ring->clear_password("Duke", 'my@@domain'));
-ok(1, "clear_password works");
-
-
 VERSION = "0.21"
 
 UPDATED_FILES = [
-    "lib/Passwd/Keyring/Gnome.pm",
+    "lib/Passwd/Keyring/KDEWallet.pm",
     ]
 
 def _patch_perl_files(ui, new_version_no):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.