Config-OpenSSH-Authkey

 view release on metacpan or  search on metacpan

t/040-authkey.t  view on Meta::CPAN

        'Config::OpenSSH::Authkey',
        qw/new fh file iterate consume parse
          get_stored_keys reset_store reset_dups
          auto_store tag_dups nostore_nonkey_data/
    );

    my $ak = Config::OpenSSH::Authkey->new();
    isa_ok( $ak, 'Config::OpenSSH::Authkey' );
    ok( !@{ $ak->get_stored_keys }, 'check that no keys exist' );

    my @prefs = qw/auto_store tag_dups nostore_nonkey_data/;
    for my $pref (@prefs) {
        is( $ak->$pref, 0, "check default for $pref setting" );
    }

    # Confirm options can be passed to new()
    my $ak_opts = Config::OpenSSH::Authkey->new(
        { auto_store => 1, tag_dups => 1, nostore_nonkey_data => 1 } );
    for my $pref (@prefs) {
        is( $ak_opts->$pref, 1, "check non-default for $pref setting" );
    }

    $ak->auto_store(1);
    $ak->nostore_nonkey_data(1);
    is( $ak->auto_store, 1, 'check that auto_store setting updated' );

    $ak->file('t/authorized_keys')->consume;
    is( scalar @{ $ak->get_stored_keys }, 6, 'check that all keys loaded' );



( run in 0.584 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )