/[A3C]/t/00-model-hrEduOrg.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

Annotation of /t/00-model-hrEduOrg.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (hide annotations)
Mon May 26 17:51:43 2008 UTC (15 years, 10 months ago) by dpavlin
File MIME type: application/x-troff
File size: 2465 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 dpavlin 128 #!/usr/bin/env perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the hrEduOrg 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::hrEduOrg');
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::hrEduOrg->new(current_user => $system_user);
22     my ($id) = $o->create(
23     'dc' => "dc",
24     'uid' => 'foo',
25     'cn' => [
26     "cn",
27     "RFC2256: common name(s) for which the entity is known by",
28     ],
29     'homeDirectory' => "homeDirectory",
30     'hrEduOrgMail' => ["hrEduOrgMail", "Sluzbena e-mail adresa ustanove"],
31     'uidNumber' => 42,
32     'hrEduOrgURL' => "hrEduOrgURL",
33     'objectClass' => ["objectClass", "RFC2256: object classes of the entity"],
34     'gidNumber' => 1042,
35     'hrEduOrgUniqueNumber' => [
36     "hrEduOrgUniqueNumber",
37     "Visestruka vrijednost brojcani identifikator ustanove",
38     ],
39     'hrEduOrgType' => "hrEduOrgType",
40     'o' => ["o", "RFC2256: organization this object belongs to"],
41     );
42     ok($id, "hrEduOrg create returned success");
43     ok($o->id, "New hrEduOrg has valid id set");
44     is($o->id, $id, "Create returned the right id");
45    
46     # And another
47     $o->create(
48     'dc' => "dc",
49     'uid' => 'bar',
50     'cn' => [
51     "cn",
52     "RFC2256: common name(s) for which the entity is known by",
53     ],
54     'homeDirectory' => "homeDirectory",
55     'hrEduOrgMail' => ["hrEduOrgMail", "Sluzbena e-mail adresa ustanove"],
56     'uidNumber' => 43,
57     'hrEduOrgURL' => "hrEduOrgURL",
58     'objectClass' => ["objectClass", "RFC2256: object classes of the entity"],
59     'gidNumber' => 1043,
60     'hrEduOrgUniqueNumber' => [
61     "hrEduOrgUniqueNumber",
62     "Visestruka vrijednost brojcani identifikator ustanove",
63     ],
64     'hrEduOrgType' => "hrEduOrgType",
65     'o' => ["o", "RFC2256: organization this object belongs to"],
66     );
67     ok($o->id, "hrEduOrg create returned another value");
68     isnt($o->id, $id, "And it is different from the previous one");
69    
70     # Searches in general
71     my $collection = A3C::Model::hrEduOrgCollection->new(current_user => $system_user);
72     $collection->unlimit;
73     is($collection->count, 2, "Finds two records");
74    
75     # Searches in specific
76     $collection->limit(column => 'id', value => $o->id);
77     is($collection->count, 1, "Finds one record with specific id");
78    
79     # Delete one of them
80     $o->delete;
81     $collection->redo_search;
82     is($collection->count, 0, "Deleted row is gone");
83    
84     # And the other one is still there
85     $collection->unlimit;
86     is($collection->count, 1, "Still one left");

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26