=================================================================== RCS file: /cvs/palm/Palm-Keyring/t/keyring5.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- palm/Palm-Keyring/t/keyring5.t 2007/02/19 01:37:10 1.2 +++ palm/Palm-Keyring/t/keyring5.t 2007/02/19 02:55:35 1.3 @@ -1,9 +1,9 @@ #!/usr/bin/perl -# $RedRiver: keyring5.t,v 1.1 2007/02/19 00:28:28 andrew Exp $ +# $RedRiver: keyring5.t,v 1.2 2007/02/19 01:37:10 andrew Exp $ use strict; use warnings; -use Test::More tests => 118; +use Test::More tests => 126; use YAML; BEGIN { @@ -27,13 +27,15 @@ cipher => $cipher, }; + my $rec1_name = 'test'; + my $original_accts = [ [ { 'label_id' => 2, 'data' => 'only password is set', 'label' => 'password', - 'font' => 0 + 'font' => 0, }, { 'label_id' => 3, @@ -43,21 +45,15 @@ 'year' => 107 }, 'label' => 'lastchange', - 'font' => 0 + 'font' => 0, } ], [ { - 'label_id' => 1, - 'data' => 'test', - 'label' => 'account', - 'font' => 0 - }, - { 'label_id' => 2, 'data' => 'abcd1234', 'label' => 'password', - 'font' => 0 + 'font' => 0, }, { 'label_id' => 3, @@ -67,13 +63,13 @@ 'year' => 107 }, 'label' => 'lastchange', - 'font' => 0 + 'font' => 0, }, { 'label_id' => 255, 'data' => 'This is a short note.', 'label' => 'notes', - 'font' => 0 + 'font' => 0, } ], [ @@ -81,7 +77,7 @@ 'label_id' => 2, 'data' => 'password (date is 2/2/07)', 'label' => 'password', - 'font' => 0 + 'font' => 0, }, { 'label_id' => 3, @@ -91,7 +87,7 @@ 'year' => 107 }, 'label' => 'lastchange', - 'font' => 0 + 'font' => 0, } ] ]; @@ -102,9 +98,14 @@ . $options->{cipher} ); + my $rec_id = 0; foreach my $acct (@{ $original_accts} ) { ok( $record = $pdb->append_Record(), 'Append Record' ); + if ($rec_id == 1) { + ok( $record->{name} = $rec1_name, 'Setting record name' ); + } ok( $pdb->Encrypt($record, $acct, $password), 'Encrypt account into record' ); + $rec_id++; } ok( $pdb->Write($file), 'Write file' ); @@ -117,12 +118,17 @@ ok( $pdb->Password($password), 'Verify Password' ); + $rec_id = 0; foreach my $rec (@{ $pdb->{records} }) { ok( $decrypted = $pdb->Decrypt($rec), 'Decrypt record' ); + if ($rec_id == 1) { + is( $rec->{name}, $rec1_name, 'Checking record name' ); + } push @recs, $decrypted; + $rec_id++; } - is_deeply( $original_accts, \@recs, 'Account Matches' ); + is_deeply( \@recs, $original_accts, 'Account Matches' ); @recs = (); my $rec_num = 1; @@ -134,7 +140,7 @@ push @recs, $decrypted; } - is_deeply( $original_accts, \@recs, 'Account Matches' ); + is_deeply( \@recs, $original_accts, 'Account Matches' ); my $acct; ok( $acct = $pdb->Decrypt( $pdb->{records}->[$rec_num]), 'decrypt record ' . $rec_num);