[Bps-public-commit] r12378 - in Prophet/branches/luid: t

sartak at bestpractical.com sartak at bestpractical.com
Fri May 16 06:50:52 EDT 2008


Author: sartak
Date: Fri May 16 06:50:52 2008
New Revision: 12378

Added:
   Prophet/branches/luid/t/luid.t
Modified:
   Prophet/branches/luid/   (props changed)

Log:
 r55970 at onn:  sartak | 2008-05-16 06:50:37 -0400
 Basic tests for luid


Added: Prophet/branches/luid/t/luid.t
==============================================================================
--- (empty file)
+++ Prophet/branches/luid/t/luid.t	Fri May 16 06:50:52 2008
@@ -0,0 +1,36 @@
+use warnings;
+use strict;
+use Test::More tests => 10;
+
+use File::Temp qw'tempdir';
+
+use_ok('Prophet::CLI');
+$ENV{'PROPHET_REPO'} = tempdir( CLEANUP => 0 ) . '/repo-' . $$;
+my $cli = Prophet::CLI->new();
+my $cxn = $cli->app_handle->handle;
+
+my $record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+my $uuid = $record->create(props => {});
+my $luid = $record->luid;
+ok($uuid, "got a uuid");
+ok($luid, "got a luid");
+
+$record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record->load(uuid => $uuid);
+is($record->uuid, $uuid, "load accepts a uuid");
+
+$record = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record->load(luid => $luid);
+is($record->uuid, $uuid, "load accepts an luid");
+is($record->luid, $luid, "same luid after load");
+
+my $record2 = Prophet::Record->new(handle => $cxn, type => 'Empty');
+my $uuid2 = $record2->create(props => {});
+my $luid2 = $record2->luid;
+isnt($uuid, $uuid2, "different uuids");
+isnt($luid, $luid2, "different luids");
+
+$record2 = Prophet::Record->new(handle => $cxn, type => 'Empty');
+$record2->load(luid => $luid2);
+is($record2->uuid, $uuid2, "load accepts an luid");
+is($record2->luid, $luid2, "same luid after load");



More information about the Bps-public-commit mailing list