11 |
use Jifty::Test tests => 11; |
use Jifty::Test tests => 11; |
12 |
|
|
13 |
# Make sure we can load the model |
# Make sure we can load the model |
14 |
use_ok('CAdmin::Model::User'); |
use_ok('A3C::Model::User'); |
15 |
|
|
16 |
# Grab a system user |
# Grab a system user |
17 |
my $system_user = CAdmin::CurrentUser->superuser; |
my $system_user = A3C::CurrentUser->superuser; |
18 |
ok($system_user, "Found a system user"); |
ok($system_user, "Found a system user"); |
19 |
|
|
20 |
# Try testing a create |
# Try testing a create |
21 |
my $o = CAdmin::Model::User->new(current_user => $system_user); |
my $o = A3C::Model::User->new(current_user => $system_user); |
22 |
my ($id) = $o->create( |
my ($id) = $o->create( |
23 |
|
uid => 42, |
24 |
|
hrEduPersonUniqueID => 42, |
25 |
|
hrEduPersonExpireDate => '2042-12-30', |
26 |
sn => 'Foo', |
sn => 'Foo', |
27 |
givenName => 'Bar', |
givenName => 'Bar', |
28 |
hrEduPersonUniqueNumber => 42, |
hrEduPersonUniqueNumber => 42, |
38 |
|
|
39 |
# And another |
# And another |
40 |
$o->create( |
$o->create( |
41 |
|
uid => 1001, |
42 |
|
hrEduPersonUniqueID => 1001, |
43 |
|
hrEduPersonExpireDate => '1999-01-01', |
44 |
sn => 'Fooby', |
sn => 'Fooby', |
45 |
givenName => 'Bary', |
givenName => 'Bary', |
46 |
hrEduPersonUniqueNumber => 1001, |
hrEduPersonUniqueNumber => 1001, |
54 |
isnt($o->id, $id, "And it is different from the previous one"); |
isnt($o->id, $id, "And it is different from the previous one"); |
55 |
|
|
56 |
# Searches in general |
# Searches in general |
57 |
my $collection = CAdmin::Model::UserCollection->new(current_user => $system_user); |
my $collection = A3C::Model::UserCollection->new(current_user => $system_user); |
58 |
$collection->unlimit; |
$collection->unlimit; |
59 |
is($collection->count, 2, "Finds two records"); |
is($collection->count, 2, "Finds two records"); |
60 |
|
|