[Bps-public-commit] r11585 - SVN-PropDB/t

clkao at bestpractical.com clkao at bestpractical.com
Sun Apr 6 06:35:39 EDT 2008


Author: clkao
Date: Sun Apr  6 06:35:09 2008
New Revision: 11585

Added:
   SVN-PropDB/t/export.t

Log:
simple tests for export.

Added: SVN-PropDB/t/export.t
==============================================================================
--- (empty file)
+++ SVN-PropDB/t/export.t	Sun Apr  6 06:35:09 2008
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Test::Exception;
+
+use Prophet::Test tests => 12;
+use Test::Exception;
+
+as_alice {
+    run_ok( 'prophet-node-create', [qw(--type Bug --status new --from alice )], "Created a record as alice" );
+    run_output_matches( 'prophet-node-search', [qw(--type Bug --regex .)], [qr/new/], " Found our record" );
+};
+
+diag('Bob syncs from alice');
+
+my $record_id;
+
+use File::Temp 'tempdir';
+
+as_bob {
+
+    run_ok( 'prophet-node-create', [qw(--type Dummy --ignore yes)], "Created a dummy record" );
+
+    run_ok( 'prophet', ['merge', '--to', repo_uri_for('bob'), '--from', repo_uri_for('alice') ], "Sync ran ok!" );
+
+    # check our local replicas
+    my ( $ret, $out, $err ) = run_script( 'prophet-node-search', [qw(--type Bug --regex .)] );
+    like( $out, qr/new/, "We have the one node from alice" );
+    if ( $out =~ /^(.*?)\s./ ) {
+        $record_id = $1;
+    }
+    diag($record_id);
+
+    run_ok( 'prophet-node-update', [ '--type', 'Bug', '--uuid', $record_id, '--status' => 'stalled' ] );
+    run_output_matches(
+        'prophet-node-show',
+        [ '--type',            'Bug',             '--uuid', $record_id ],
+        [ 'id: ' . $record_id, 'status: stalled', 'from: alice' ],
+        'content is correct'
+    );
+
+    my $path = Path::Class::dir->new( tempdir( CLEANUP => $ENV{TEST_VERBOSE} ) );
+
+    run_ok( 'prophet', [ 'export', '--path', $path ] );
+    my $cli = Prophet::CLI->new;
+    $path = $path->subdir( "_prophet-" . $cli->handle->db_uuid );
+    ok( -d $path,                       'found db-uuid root.' );
+    ok( -e $path->file('replica-uuid'), 'found replica uuid file' );
+    lives_and {
+        is( $path->file('replica-uuid')->slurp, replica_uuid() );
+    };
+
+    ok( -e $path->file('changesets.idx'), 'found changesets index' );
+
+};
+



More information about the Bps-public-commit mailing list