/[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 208 - (hide annotations)
Thu Jun 19 21:24:26 2008 UTC (15 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 2623 byte(s)
another round of re-factoring

- re-organize LDAP-related pages under /ldap with new view A3C::View::LDAP
- move record multi-value support into A3C::Record
- document multi-value solution which started it all
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 dpavlin 208 use Jifty::Test tests => 12;
12 dpavlin 128
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 dpavlin 208 # multi-value rollup
71     use Data::Dump qw/dump/;
72     dump( $o->cn );
73     is( $o->cn, 'cn <*> RFC2256: common name(s) for which the entity is known by', 'ARRAY value');
74    
75 dpavlin 128 # Searches in general
76     my $collection = A3C::Model::hrEduOrgCollection->new(current_user => $system_user);
77     $collection->unlimit;
78     is($collection->count, 2, "Finds two records");
79    
80     # Searches in specific
81     $collection->limit(column => 'id', value => $o->id);
82     is($collection->count, 1, "Finds one record with specific id");
83    
84     # Delete one of them
85     $o->delete;
86     $collection->redo_search;
87     is($collection->count, 0, "Deleted row is gone");
88    
89     # And the other one is still there
90     $collection->unlimit;
91     is($collection->count, 1, "Still one left");

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26