[Jifty-commit] r2777 - in jifty/branches/virtual-models: .

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Feb 10 18:58:51 EST 2007


Author: jesse
Date: Sat Feb 10 18:58:50 2007
New Revision: 2777

Added:
   jifty/branches/virtual-models/t/TestApp/t/uuid.t
Modified:
   jifty/branches/virtual-models/   (props changed)

Log:
 r21969 at hualien:  jesse | 2007-02-10 17:50:32 -0500
 * Basic UUID testing 
 


Added: jifty/branches/virtual-models/t/TestApp/t/uuid.t
==============================================================================
--- (empty file)
+++ jifty/branches/virtual-models/t/TestApp/t/uuid.t	Sat Feb 10 18:58:50 2007
@@ -0,0 +1,46 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+A basic test harness for the User model.
+
+=cut
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test tests => 12;
+# Make sure we can load the model
+use_ok('TestApp::Model::User');
+
+# Grab a system use
+my $system_user = TestApp::CurrentUser->superuser;
+ok($system_user, "Found a system user");
+
+# Try testing a create
+my $o = TestApp::Model::User->new(current_user => $system_user);
+my ($id) = $o->create( name => $$, email => $$, password => $$ );
+ok($id, "User create returned success");
+ok($o->id, "New User has valid id set");
+is($o->id, $id, "Create returned the right id");
+is($o->name, $$, "Created object has the right name");
+ok($o->__uuid, "We got a UUID");
+
+
+
+# And another
+my $p = TestApp::Model::User->new(current_user => $system_user);
+$p->create( name => $$, email => $$, password => $$ );
+ok($p->id, "User create returned another value");
+isnt($p->__uuid, $o->__uuid, "And it is different from the previous one");
+
+my $generated_uuid = Jifty::Util->generate_uuid;
+my $q = TestApp::Model::User->new(current_user => $system_user);
+$q->create( name => $$, email => $$, password => $$, __uuid =>$generated_uuid);
+ok($q->id, "User create returned another value");
+is($q->__uuid, $generated_uuid);
+isnt($q->__uuid, $o->__uuid, "And it is different from the previous one");
+
+


More information about the Jifty-commit mailing list