App-KGB

 view release on metacpan or  search on metacpan

t/50-client.t  view on Meta::CPAN

PERL5LIB=$R/lib $^X -- $R/script/kgb-client --conf $R/eg/test-client.conf --status-dir $r \$1 \$2 >> /dev/null
EOF
    close $h;
}
system 'svn', 'checkout', "file://$repo", $wd;

poke('one');
in_wd "svn add $tf";
in_wd "svn ci -m 'add file'";

TestBot->expect(
    "dummy/#test 12test/ 1 ${TestBot::COMMIT_USER} 03/file add file * 14http://scm.host.org///?commit=1"
);

poke('two');
in_wd "svn ci -m 'modify file'";

TestBot->expect(
    "dummy/#test 12test/ 2 ${TestBot::COMMIT_USER} 10/file modify file * 14http://scm.host.org///?commit=2"
);

in_wd "svn rm file";
poke('three');
in_wd "svn add file";
in_wd "svn ci -m 'replace file'";

TestBot->expect(
    "dummy/#test 12test/ 3 ${TestBot::COMMIT_USER} 05/file replace file * 14http://scm.host.org///?commit=3"
);

ok( 1, "Test repository prepared" );

use App::KGB::Client::Subversion;
use App::KGB::Client::ServerRef;

my $port = 7645;
my $password = 'v,sjflir';

my $c = new_ok(
    'App::KGB::Client::Subversion' => [
        {   repo_id => 'test',
            servers => [
                App::KGB::Client::ServerRef->new(
                    {   uri      => "http://127.0.0.1:$port/",
                        password => $password,
                    }
                ),
            ],

            #br_mod_re      => \@br_mod_re,
            #br_mod_re_swap => $br_mod_re_swap,
            #ignore_branch  => $ignore_branch,
            repo_path => $repo,
            revision  => 1,
        }
    ]
);

my $commit = $c->describe_commit;

my $me = getpwuid($>);

is( $commit->id, 1 );
is( $commit->log, 'add file' );
diag "\$>=$> \$<=$< \$ENV{USER}=$ENV{USER} getpwuid(\$>)=$me";
is( $commit->author, $me );
is( scalar @{ $commit->changes }, 1 );

my $change = $commit->changes->[0];
is( $change->path, '/file' );
ok( not $change->prop_change );
is( $change->action, 'A' );

$c->revision(2);
$c->_called(0);
$commit = $c->describe_commit;

is( $commit->id, 2 );
is( $commit->log, 'modify file' );
is( $commit->author, $me );
is( scalar @{ $commit->changes }, 1 );

$change = $commit->changes->[0];
is( $change->path, '/file' );
ok( not $change->prop_change );
is( $change->action, 'M' );

$c->revision(3);
$c->_called(0);
$commit = $c->describe_commit;

is( $commit->id, 3 );
is( $commit->log, 'replace file' );
is( $commit->author, $me );
is( scalar @{ $commit->changes }, 1 );

$change = $commit->changes->[0];
is( $change->path, '/file' );
ok( not $change->prop_change );
is( $change->action, 'R' );

SKIP: {
    skip "UTF-8 locale needed for the test with UTF-8 commit message", 7,
        unless ( ( setlocale(LC_CTYPE) // '' ) =~ /utf-8$/i );

    in_wd "svn rm file";
    in_wd "svn ci -m 'remove file. Über cool with cyrillics: здрасти'";

    TestBot->expect( "dummy/#test"
        ." 12test/ "
        . "4 "
        . ${TestBot::COMMIT_USER}
        . " 04/file "
        . "remove file. Über cool with cyrillics: здрасти "
        . "* 14http://scm.host.org///?commit=4");

    $c->revision(4);
    $c->_called(0);
    $commit = $c->describe_commit;

    is( $commit->id, 4 );
    is( $commit->log, 'remove file. Über cool with cyrillics: здрасти' );
    is( $commit->author, $me );
    is( scalar @{ $commit->changes }, 1 );



( run in 0.881 second using v1.01-cache-2.11-cpan-995e09ba956 )