Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/perl/native/t/3client.t  view on Meta::CPAN

          [ 1..$current_rev ], 'single [start, end]');
# TEST
is_deeply(get_revs([[1, $opt_revision_head]]),
          [ 1..$current_rev ], 'list of [start, end]');
# TEST
is_deeply(get_revs($bottom), 
          [ 1..$current_rev-1 ], 'single svn_opt_revision_range_t');
# TEST
is_deeply(get_revs([$bottom]), 
          [ 1..$current_rev-1 ], 'list of svn_opt_revision_range_t');
# TEST
is_deeply(get_revs([1, $current_rev-1]),
          [ 1..$current_rev-1 ], 'single [start, end]');
# TEST
is_deeply(get_revs([[1, $current_rev-1]]),
          [ 1..$current_rev-1 ], 'list of [start, end]');
# TEST
is_deeply(get_revs([[1, $current_rev-1], $top]),
          [ 1..$current_rev ], 'mixed list of ranges');
# TEST
is_deeply(get_revs([$bottom, ['HEAD', 'HEAD']]),
          [ 1..$current_rev ], 'mixed list of ranges');
# TEST
is_deeply(get_revs([$bottom, $top]),
          [ 1..$current_rev ], 'mixed list of ranges');
          

# TEST
is($ctx->update($wcpath,'HEAD',1),$current_rev,
   'Return from update is the current rev');

my $update2_result = $ctx->update2([$wcpath],'HEAD',1,0);
# TEST
isa_ok($update2_result,'ARRAY','update2 returns a list');
# TEST
is(scalar(@$update2_result),1,'update2 member count');
# TEST
is($update2_result->[0],$current_rev,'return from update2 is the current rev');

my $update3_result = $ctx->update3([$wcpath],'HEAD',$SVN::Depth::infinity,
	                                 0,0,0);
# TEST
isa_ok($update3_result,'ARRAY','update3 returns a list');
# TEST
is(scalar(@$update3_result),1,'update3 member count');
# TEST
is($update3_result->[0],$current_rev,'return from update3 is the current rev');

my $update4_result = $ctx->update4([$wcpath],'HEAD',$SVN::Depth::infinity,
                                   0,0,0,1,0);
# TEST
isa_ok($update4_result,'ARRAY','update4 returns a list');
# TEST
is(scalar(@$update4_result),1,'update4 member count');
# TEST
is($update4_result->[0],$current_rev,'return from update4 is the current rev');

# no return so we should get undef as the result
# we will get a _p_svn_error_t if there is an error.
# TEST
is($ctx->propset('perl-test','test-val',"$wcpath/dir1",0),undef,
   'propset on a working copy path returns undef');

my ($ph) = $ctx->propget('perl-test',"$wcpath/dir1",undef,0);
# TEST
isa_ok($ph,'HASH','propget returns a hash');
# TEST
is($ph->{"$wcpath/dir1"},'test-val','perl-test property has the correct value');

# No revnum for the working copy so we should get INVALID_REVNUM
# TEST
is($ctx->status($wcpath, undef, sub {
                                      my ($path,$wc_status) = @_;
                                      # TEST
                                      is($path,"$wcpath/dir1",
                                         'path param to status callback is' .
                                         ' the correct path.');
                                      # TEST
                                      isa_ok($wc_status,'_p_svn_wc_status_t',
                                             'wc_stats param');
                                      # TEST
                                      is($wc_status->text_status(),
                                         $SVN::Wc::Status::normal,
                                         'text_status param to status' .
                                         ' callback');
                                      # TEST
                                      is($wc_status->prop_status(),
                                         $SVN::Wc::Status::modified,
                                         'prop_status param to status' .
                                         ' callback');
                                      # TEST
                                      is($wc_status->locked(), 0,
                                         'locked param to status callback');
                                      # TEST
                                      is($wc_status->copied(), 0,
                                         'copied param to status callback');
                                      # TEST
                                      is($wc_status->switched(), 0,
                                         'switched param to status callback');
                                      # TEST
                                      is($wc_status->repos_text_status(),
                                         $SVN::Wc::Status::none,
                                         'repos_text_status param to status' .
                                         ' callback');
                                      # TEST
                                      is($wc_status->repos_prop_status(),
                                         $SVN::Wc::Status::none,
                                         'repos_prop_status param to status' .
                                         ' callback');
                                    },
                1, 0, 0, 0),
   $SVN::Core::INVALID_REVNUM,
   'status returns INVALID_REVNUM when run against a working copy');

# No revnum for the working copy so we should get INVALID_REVNUM
# TEST
is($ctx->status2($wcpath, undef, sub {
                                      my ($path,$wc_status) = @_;
                                      # TEST
                                      is($path,"$wcpath/dir1",
                                         'path param to status2 callback');
                                      # TEST

src/subversion/subversion/bindings/swig/perl/native/t/3client.t  view on Meta::CPAN

                                                # TEST
                                                is($line,"foobar\r\r",
                                                   'line is expected value');
                                              } else {
                                                # TEST
                                                is($line,'foobar',
                                                   'line is expected value');
                                              }
                                              # TEST
                                              isa_ok($pool,'_p_apr_pool_t',
                                                     'pool param');
                                            }),
   undef,
   'blame returns undef');

# TEST
ok(open(CAT, "+>$testpath/cattest"),'open file for cat output');
# TEST
is($ctx->cat(\*CAT, "$reposurl/foo", 'HEAD'),undef,
   'cat returns undef');
# TEST
ok(seek(CAT,0,0),
   'seek the beginning of the cat file');
# TEST
is(readline(*CAT),'foobar',
   'read the first line of the cat file');
# TEST
ok(close(CAT),'close cat file');

# the string around the $current_rev exists to expose a past
# bug.  In the past we did not accept values that simply
# had not been converted to a number yet.
my ($dirents) = $ctx->ls($reposurl,"$current_rev", 1);
# TEST
isa_ok($dirents, 'HASH','ls returns a HASH');
# TEST
isa_ok($dirents->{'dir1'},'_p_svn_dirent_t',
       'dirents hash value');
# TEST
is($dirents->{'dir1'}->kind(),$SVN::Core::node_dir,
   'kind() returns a dir node');
# TEST
is($dirents->{'dir1'}->size(),0,
   'size() returns 0 for a directory');
# TEST
is($dirents->{'dir1'}->has_props(),1,
   'has_props() returns true');
# TEST
is($dirents->{'dir1'}->created_rev(),$dir1_rev,
   'created_rev() returns expected rev');
# TEST
ok($dirents->{'dir1'}->time(),
   'time is defined');
#diag(scalar(localtime($dirents->{'dir1'}->time() / 1000000)));
# TEST
is($dirents->{'dir1'}->last_author(),$username,
   'last_auth() returns expected username');

# test removing a property
# TEST
is($ctx->propset('perl-test', undef, "$wcpath/dir1", 0),undef,
   'propset returns undef');

my ($ph2) = $ctx->propget('perl-test', "$wcpath/dir1", 'WORKING', 0);
# TEST
isa_ok($ph2,'HASH','propget returns HASH');
# TEST
is(scalar(keys %$ph2),0,
   'No properties after deleting a property');

SKIP: {
    # This is ugly.  It is included here as an aide to understand how
    # to test this and because it makes my life easier as I only have
    # one command to run to test it.  If you want to use this you need
    # to change the usernames, passwords, and paths to the client cert.
    # It assumes that there is a repo running on localhost port 443 at
    # via SSL.  The repo cert should trip a client trust issue.  The
    # client cert should be encrypted and require a pass to use it.
    # Finally uncomment the skip line below.

    # Before shipping make sure the following line is uncommented.
    skip 'Impossible to test without external effort to setup https', 7;

    sub simple_prompt {
        my $cred = shift;
        my $realm = shift;
        my $username_passed = shift;
        my $may_save = shift;
        my $pool = shift;

        ok(1,'simple_prompt called');
        $cred->username('breser');
        $cred->password('foo');
    }

    sub ssl_server_trust_prompt {
        my $cred = shift;
        my $realm = shift;
        my $failures = shift;
        my $cert_info = shift;
        my $may_save = shift;
        my $pool = shift;

        ok(1,'ssl_server_trust_prompt called');
        $cred->may_save(0);
        $cred->accepted_failures($failures);
    }

    sub ssl_client_cert_prompt {
        my $cred = shift;
        my $realm = shift;
        my $may_save = shift;
        my $pool = shift;

        ok(1,'ssl_client_cert_prompt called');
        $cred->cert_file('/home/breser/client-pass.p12');
    }

    sub ssl_client_cert_pw_prompt {
        my $cred = shift;
        my $may_save = shift;
        my $pool = shift;



( run in 0.678 second using v1.01-cache-2.11-cpan-71847e10f99 )