/[A3C]/t/00-model-hrEduPerson.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /t/00-model-hrEduPerson.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (show annotations)
Mon May 26 17:51:43 2008 UTC (15 years, 10 months ago) by dpavlin
File MIME type: application/x-troff
File size: 2948 byte(s)
Override hrEduOrg->create to accept arrays as values and convert
them into ' <*> ' delimited strings, just like ldap sync does
and test that functionality
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 =head1 DESCRIPTION
6
7 A basic test harness for the hrEduPerson model.
8
9 =cut
10
11 use Jifty::Test tests => 11;
12
13 # Make sure we can load the model
14 use_ok('A3C::Model::hrEduPerson');
15
16 # Grab a system user
17 my $system_user = A3C::CurrentUser->superuser;
18 ok($system_user, "Found a system user");
19
20 # Try testing a create
21 my $o = A3C::Model::hrEduPerson->new(current_user => $system_user);
22 my ($id) = $o->create(
23 'uid' => ["uid", "RFC1274: user identifier"],
24 'hrEduPersonExpireDate' => "hrEduPersonExpireDate",
25 'hrEduPersonPrimaryAffiliation' => "hrEduPersonPrimaryAffiliation",
26 'cn' => [
27 "cn",
28 "RFC2256: common name(s) for which the entity is known by",
29 ],
30 'homeDirectory' => "homeDirectory",
31 'uidNumber' => "uidNumber",
32 'objectClass' => ["objectClass", "RFC2256: object classes of the entity"],
33 'hrEduPersonUniqueNumber' => ["hrEduPersonUniqueNumber", "Jedinstveni identifikator osobe"],
34 'gidNumber' => "gidNumber",
35 'hrEduPersonUniqueID' => "hrEduPersonUniqueID",
36 'sn' => [
37 "sn",
38 "RFC2256: last (family) name(s) for which the entity is known by",
39 ],
40 'hrEduPersonHomeOrg' => "hrEduPersonHomeOrg",
41 'hrEduPersonAffiliation' => [
42 "hrEduPersonAffiliation",
43 "Odredjuje vezu izmedju osobe i maticne ustanove.",
44 ],
45 );
46 ok($id, "hrEduPerson create returned success");
47 ok($o->id, "New hrEduPerson has valid id set");
48 is($o->id, $id, "Create returned the right id");
49
50 # And another
51 $o->create(
52 'uid' => ["uid", "RFC1274: user identifier"],
53 'hrEduPersonExpireDate' => "hrEduPersonExpireDate",
54 'hrEduPersonPrimaryAffiliation' => "hrEduPersonPrimaryAffiliation",
55 'cn' => [
56 "cn",
57 "RFC2256: common name(s) for which the entity is known by",
58 ],
59 'homeDirectory' => "homeDirectory",
60 'uidNumber' => "uidNumber",
61 'objectClass' => ["objectClass", "RFC2256: object classes of the entity"],
62 'hrEduPersonUniqueNumber' => ["hrEduPersonUniqueNumber", "Jedinstveni identifikator osobe"],
63 'gidNumber' => "gidNumber",
64 'hrEduPersonUniqueID' => "hrEduPersonUniqueID",
65 'sn' => [
66 "sn",
67 "RFC2256: last (family) name(s) for which the entity is known by",
68 ],
69 'hrEduPersonHomeOrg' => "hrEduPersonHomeOrg",
70 'hrEduPersonAffiliation' => [
71 "hrEduPersonAffiliation",
72 "Odredjuje vezu izmedju osobe i maticne ustanove.",
73 ],
74 );
75 ok($o->id, "hrEduPerson create returned another value");
76 isnt($o->id, $id, "And it is different from the previous one");
77
78 # Searches in general
79 my $collection = A3C::Model::hrEduPersonCollection->new(current_user => $system_user);
80 $collection->unlimit;
81 is($collection->count, 2, "Finds two records");
82
83 # Searches in specific
84 $collection->limit(column => 'id', value => $o->id);
85 is($collection->count, 1, "Finds one record with specific id");
86
87 # Delete one of them
88 $o->delete;
89 $collection->redo_search;
90 is($collection->count, 0, "Deleted row is gone");
91
92 # And the other one is still there
93 $collection->unlimit;
94 is($collection->count, 1, "Still one left");

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26