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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations)
Tue Mar 18 19:03:53 2008 UTC (16 years, 1 month ago) by dpavlin
File MIME type: application/x-troff
File size: 1505 byte(s)
- move organisations in own model
- more general ldap2model sub will try to fill model with ldap entry data
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 =head1 DESCRIPTION
6
7 A basic test harness for the Organization 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::Organization');
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::Organization->new(current_user => $system_user);
22 my ($id) = $o->create(
23 o => 'CARNet',
24 hrEduPersonHomeOrg => 'skole.hr',
25 postalAddress => 'Pere Perica b.b.',
26 l => 'Zagreb',
27 );
28 ok($id, "Organization create returned success");
29 ok($o->id, "New Organization has valid id set");
30 is($o->id, $id, "Create returned the right id");
31
32 # And another
33 $o->create(
34 o => 'Osnovna skola',
35 hrEduPersonHomeOrg => 'skole.hr',
36 postalAddress => 'Pere Perica b.b.',
37 l => 'Zagreb',
38 );
39 ok($o->id, "Organization create returned another value");
40 isnt($o->id, $id, "And it is different from the previous one");
41
42 # Searches in general
43 my $collection = A3C::Model::OrganizationCollection->new(current_user => $system_user);
44 $collection->unlimit;
45 is($collection->count, 2, "Finds two records");
46
47 # Searches in specific
48 $collection->limit(column => 'id', value => $o->id);
49 is($collection->count, 1, "Finds one record with specific id");
50
51 # Delete one of them
52 $o->delete;
53 $collection->redo_search;
54 is($collection->count, 0, "Deleted row is gone");
55
56 # And the other one is still there
57 $collection->unlimit;
58 is($collection->count, 1, "Still one left");
59

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26