[BACK]Return to keyring5.t CVS log [TXT][DIR] Up to [local] / palm / Palm-Keyring / t

Diff for /palm/Palm-Keyring/t/keyring5.t between version 1.2 and 1.3

version 1.2, 2007/02/19 01:37:10 version 1.3, 2007/02/19 02:55:35
Line 1 
Line 1 
 #!/usr/bin/perl  #!/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 strict;
 use warnings;  use warnings;
   
 use Test::More tests => 118;  use Test::More tests => 126;
 use YAML;  use YAML;
   
 BEGIN {  BEGIN {
Line 27 
Line 27 
         cipher   => $cipher,          cipher   => $cipher,
     };      };
   
       my $rec1_name = 'test';
   
     my $original_accts = [      my $original_accts = [
     [      [
     {      {
         'label_id' => 2,          'label_id' => 2,
         'data' => 'only password is set',          'data' => 'only password is set',
         'label' => 'password',          'label' => 'password',
         'font' => 0          'font' => 0,
     },      },
     {      {
         'label_id' => 3,          'label_id' => 3,
Line 43 
Line 45 
             'year' => 107              'year' => 107
         },          },
         'label' => 'lastchange',          'label' => 'lastchange',
         'font' => 0          'font' => 0,
     }      }
     ],      ],
     [      [
     {      {
         'label_id' => 1,  
         'data' => 'test',  
         'label' => 'account',  
         'font' => 0  
     },  
     {  
         'label_id' => 2,          'label_id' => 2,
         'data' => 'abcd1234',          'data' => 'abcd1234',
         'label' => 'password',          'label' => 'password',
         'font' => 0          'font' => 0,
     },      },
     {      {
         'label_id' => 3,          'label_id' => 3,
Line 67 
Line 63 
             'year' => 107              'year' => 107
         },          },
         'label' => 'lastchange',          'label' => 'lastchange',
         'font' => 0          'font' => 0,
     },      },
     {      {
         'label_id' => 255,          'label_id' => 255,
         'data' => 'This is a short note.',          'data' => 'This is a short note.',
         'label' => 'notes',          'label' => 'notes',
         'font' => 0          'font' => 0,
     }      }
     ],      ],
     [      [
Line 81 
Line 77 
         'label_id' => 2,          'label_id' => 2,
         'data' => 'password (date is 2/2/07)',          'data' => 'password (date is 2/2/07)',
         'label' => 'password',          'label' => 'password',
         'font' => 0          'font' => 0,
     },      },
     {      {
         'label_id' => 3,          'label_id' => 3,
Line 91 
Line 87 
             'year' => 107              'year' => 107
         },          },
         'label' => 'lastchange',          'label' => 'lastchange',
         'font' => 0          'font' => 0,
     }      }
     ]      ]
     ];      ];
Line 102 
Line 98 
         . $options->{cipher}          . $options->{cipher}
     );      );
   
       my $rec_id = 0;
     foreach my $acct (@{ $original_accts} ) {      foreach my $acct (@{ $original_accts} ) {
         ok( $record = $pdb->append_Record(), 'Append Record' );          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' );          ok( $pdb->Encrypt($record, $acct, $password), 'Encrypt account into record' );
           $rec_id++;
     }      }
   
     ok( $pdb->Write($file), 'Write file' );      ok( $pdb->Write($file), 'Write file' );
Line 117 
Line 118 
   
     ok( $pdb->Password($password), 'Verify Password' );      ok( $pdb->Password($password), 'Verify Password' );
   
       $rec_id = 0;
     foreach my $rec (@{ $pdb->{records} }) {      foreach my $rec (@{ $pdb->{records} }) {
         ok( $decrypted = $pdb->Decrypt($rec), 'Decrypt record' );          ok( $decrypted = $pdb->Decrypt($rec), 'Decrypt record' );
           if ($rec_id == 1) {
               is( $rec->{name}, $rec1_name, 'Checking record name' );
           }
         push @recs, $decrypted;          push @recs, $decrypted;
           $rec_id++;
     }      }
   
     is_deeply( $original_accts, \@recs, 'Account Matches' );      is_deeply( \@recs, $original_accts, 'Account Matches' );
   
     @recs = ();      @recs = ();
     my $rec_num = 1;      my $rec_num = 1;
Line 134 
Line 140 
         push @recs, $decrypted;          push @recs, $decrypted;
     }      }
   
     is_deeply( $original_accts, \@recs, 'Account Matches' );      is_deeply( \@recs, $original_accts, 'Account Matches' );
   
     my $acct;      my $acct;
     ok( $acct = $pdb->Decrypt( $pdb->{records}->[$rec_num]), 'decrypt record ' . $rec_num);      ok( $acct = $pdb->Decrypt( $pdb->{records}->[$rec_num]), 'decrypt record ' . $rec_num);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>