--- t/00-model-User.t 2008/03/13 19:26:56 18 +++ t/00-model-User.t 2008/03/18 19:03:53 32 @@ -8,7 +8,7 @@ =cut -use Jifty::Test tests => 11; +use Jifty::Test tests => 12; # Make sure we can load the model use_ok('A3C::Model::User'); @@ -17,20 +17,27 @@ my $system_user = A3C::CurrentUser->superuser; ok($system_user, "Found a system user"); +my $organization = A3C::Model::Organization->new(current_user => $system_user); +my ($id) = $organization->create( + o => 'CARNet', + hrEduPersonHomeOrg => 'skole.hr', + postalAddress => 'Pere Perica b.b.', + l => 'Zagreb', +); +ok($id, "Organization create returned success"); + # Try testing a create my $o = A3C::Model::User->new(current_user => $system_user); -my ($id) = $o->create( +($id) = $o->create( uid => 42, hrEduPersonUniqueID => 42, hrEduPersonExpireDate => '2042-12-30', - sn => 'Foo', - givenName => 'Bar', + givenName => 'Foo', + sn => 'Bar', + cn => 'Foo Bar', hrEduPersonUniqueNumber => 42, hrEduPersonAffiliation => 'suradnik', - o => 'CARNet', - hrEduPersonHomeOrg => 'skole.hr', - postalAddress => 'Pere Perica b.b.', - l => 'Zagreb', + organization => $organization, ); ok($id, "User create returned success"); ok($o->id, "New User has valid id set"); @@ -41,14 +48,12 @@ uid => 1001, hrEduPersonUniqueID => 1001, hrEduPersonExpireDate => '1999-01-01', - sn => 'Fooby', givenName => 'Bary', + sn => 'Fooby', + cn => 'Bary Fooby', hrEduPersonUniqueNumber => 1001, hrEduPersonAffiliation => 'gost', - o => 'CARNet', - hrEduPersonHomeOrg => 'skole.hr', - postalAddress => 'Pere Perica b.b.', - l => 'Zagreb', + organization => $organization, ); ok($o->id, "User create returned another value"); isnt($o->id, $id, "And it is different from the previous one");