8 |
|
|
9 |
=cut |
=cut |
10 |
|
|
11 |
use Jifty::Test tests => 12; |
use Jifty::Test tests => 11; |
12 |
|
|
13 |
# Make sure we can load the model |
# Make sure we can load the model |
14 |
use_ok('A3C::Model::User'); |
use_ok('A3C::Model::User'); |
17 |
my $system_user = A3C::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 |
|
my $id; |
21 |
|
|
22 |
|
=for later |
23 |
my $organization = A3C::Model::Organization->new(current_user => $system_user); |
my $organization = A3C::Model::Organization->new(current_user => $system_user); |
24 |
my ($id) = $organization->create( |
($id) = $organization->create( |
25 |
o => 'CARNet', |
o => 'CARNet', |
26 |
hrEduPersonHomeOrg => 'skole.hr', |
hrEduPersonHomeOrg => 'skole.hr', |
27 |
postalAddress => 'Pere Perica b.b.', |
postalAddress => 'Pere Perica b.b.', |
28 |
l => 'Zagreb', |
l => 'Zagreb', |
29 |
); |
); |
30 |
ok($id, "Organization create returned success"); |
ok($id, "Organization create returned success"); |
31 |
|
=cut |
32 |
|
|
33 |
# Try testing a create |
# Try testing a create |
34 |
my $o = A3C::Model::User->new(current_user => $system_user); |
my $o = A3C::Model::User->new(current_user => $system_user); |
41 |
cn => 'Foo Bar', |
cn => 'Foo Bar', |
42 |
hrEduPersonUniqueNumber => 42, |
hrEduPersonUniqueNumber => 42, |
43 |
hrEduPersonAffiliation => 'suradnik', |
hrEduPersonAffiliation => 'suradnik', |
44 |
organization => $organization, |
hrEduPersonHomeOrg => 'skole.hr', |
45 |
|
# organization => $organization, |
46 |
); |
); |
47 |
ok($id, "User create returned success"); |
ok($id, "User create returned success"); |
48 |
ok($o->id, "New User has valid id set"); |
ok($o->id, "New User has valid id set"); |
58 |
cn => 'Bary Fooby', |
cn => 'Bary Fooby', |
59 |
hrEduPersonUniqueNumber => 1001, |
hrEduPersonUniqueNumber => 1001, |
60 |
hrEduPersonAffiliation => 'gost', |
hrEduPersonAffiliation => 'gost', |
61 |
organization => $organization, |
hrEduPersonHomeOrg => 'skole.hr', |
62 |
|
# organization => $organization, |
63 |
); |
); |
64 |
ok($o->id, "User create returned another value"); |
ok($o->id, "User create returned another value"); |
65 |
isnt($o->id, $id, "And it is different from the previous one"); |
isnt($o->id, $id, "And it is different from the previous one"); |