=================================================================== RCS file: /cvs/palm/Palm-Keyring/t/keyring.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- palm/Palm-Keyring/t/keyring.t 2007/01/30 04:59:55 1.3 +++ palm/Palm-Keyring/t/keyring.t 2007/02/01 01:56:11 1.4 @@ -7,7 +7,7 @@ # (It may become useful if the test is moved to ./t subdirectory.) my $test = 1; -BEGIN { $| = 1; print "1..12\n"; } +BEGIN { $| = 1; print "1..17\n"; } END {print "not ok $test\n" unless $loaded;} use Palm::PDB; use Palm::Keyring; @@ -29,6 +29,11 @@ account => 'atestaccount', password => $password, notes => 'now that really roxorZ!', + lastchange => { + day => 2, + month => 2, + year => 99, + }, }; my $pdb; @@ -100,6 +105,8 @@ } $test++; +my $old_date = $acct->{'lastchange'}; + eval { $pdb->Password($password, $new_password) || die }; unless( $@ ) { print "ok $test\n"; @@ -123,6 +130,60 @@ print "not ok $test\n"; } $test++; + +my $new_date = $acct->{'lastchange'}; + +if ( + $old_date->{'day'} == $new_date->{'day'} && + $old_date->{'month'} == $new_date->{'month'} && + $old_date->{'year'} == $new_date->{'year'} +) { + print "ok $test\n"; +} else { + print "not ok $test\n"; +} +$test++; + +$acct->{'password'} = $new_password; + +eval { $acct = $pdb->Encrypt($pdb->{'records'}->[1], $acct) || die }; +unless( $@ ) { + print "ok $test\n"; +} else { + print "not ok $test\n"; +} +$test++; + +$old_date = $new_date; +$new_date = $acct->{'lastchange'}; + +eval { $acct = $pdb->Decrypt($pdb->{'records'}->[1]) || die }; +unless( $@ ) { + print "ok $test\n"; +} else { + print "not ok $test\n"; +} +$test++; + +if ( + $old_date->{'day'} != $new_date->{'day'} || + $old_date->{'month'} != $new_date->{'month'} || + $old_date->{'year'} != $new_date->{'year'} +) { + print "ok $test\n"; +} else { + print "not ok $test\n"; +} +$test++; + +if ($acct->{'password'} eq $new_password) { + print "ok $test\n"; +} else { + print "not ok $test\n"; +} +$test++; + + unlink($file); 1;