lportal 1.0.0 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -2
- data/init.rb +4 -0
- data/lib/announcement/entry.rb +17 -0
- data/lib/blog_post.rb +3 -0
- data/lib/bookmark/entry.rb +22 -0
- data/lib/bookmark/folder.rb +18 -0
- data/lib/calevent.rb +20 -0
- data/lib/classname.rb +78 -0
- data/lib/company.rb +5 -0
- data/lib/ig/folder.rb +11 -0
- data/lib/ig/image.rb +3 -4
- data/lib/journal/article_resource.rb +6 -2
- data/lib/mb/message.rb +0 -3
- data/lib/mb/thread.rb +5 -1
- data/lib/organization.rb +9 -2
- data/lib/resource.rb +5 -11
- data/lib/tag/asset.rb +40 -1
- data/lib/user.rb +7 -0
- data/lib/usergroup.rb +4 -4
- data/lib/web/layout.rb +4 -0
- data/lib/web/layout_set.rb +14 -10
- data/lib/web/portlet.rb +9 -9
- data/lib/web/portlet_preferences.rb +6 -6
- data/lib/wiki/page.rb +3 -0
- data/lportal.rb +12 -1
- data/test/unit/account_test.rb +5 -2
- data/test/unit/address_test.rb +0 -4
- data/test/unit/announcement/entry_test.rb +28 -0
- data/test/unit/blog_post_test.rb +38 -0
- data/test/unit/bookmark/entry_test.rb +28 -0
- data/test/unit/bookmark/folder_test.rb +22 -0
- data/test/unit/calevent_test.rb +28 -0
- data/test/unit/company_test.rb +31 -18
- data/test/unit/contact_test.rb +6 -5
- data/test/unit/group_test.rb +4 -2
- data/test/unit/ig/folder_test.rb +23 -3
- data/test/unit/ig/image_test.rb +11 -3
- data/test/unit/journal/article_image_test.rb +6 -5
- data/test/unit/journal/article_resource_test.rb +16 -3
- data/test/unit/journal/article_test.rb +19 -6
- data/test/unit/mb/category_test.rb +21 -5
- data/test/unit/mb/discussion_test.rb +9 -2
- data/test/unit/mb/message_test.rb +16 -8
- data/test/unit/mb/thread_test.rb +10 -3
- data/test/unit/organization_test.rb +20 -21
- data/test/unit/permission_test.rb +30 -9
- data/test/unit/resource_code_test.rb +8 -4
- data/test/unit/resource_test.rb +46 -24
- data/test/unit/role_test.rb +5 -3
- data/test/unit/tag/asset_test.rb +61 -0
- data/test/unit/tag/entry_test.rb +17 -7
- data/test/unit/tag/property_test.rb +12 -4
- data/test/unit/user_test.rb +37 -44
- data/test/unit/usergroup_test.rb +10 -9
- data/test/unit/web/layout_set_test.rb +38 -34
- data/test/unit/web/layout_test.rb +3 -5
- data/test/unit/web/portlet_preferences_test.rb +10 -6
- data/test/unit/web/portlet_test.rb +14 -8
- data/test/unit/wiki/node_test.rb +1 -4
- data/test/unit/wiki/page_test.rb +1 -4
- data/version.rb +4 -0
- metadata +28 -10
- data/lib/announcement.rb +0 -5
- data/lib/bookmark.rb +0 -10
- data/lib/web/portlet_name.rb +0 -6
- data/test/unit/announcement_test.rb +0 -8
- data/test/unit/asset_test.rb +0 -29
- data/test/unit/bookmark_test.rb +0 -8
- data/test/unit/user_group_test.rb +0 -8
@@ -1,33 +1,54 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
+
# this test is SLOW
|
3
4
|
class PermissionTest < ActiveSupport::TestCase
|
5
|
+
fixtures [
|
6
|
+
:permission_,
|
7
|
+
:role_,
|
8
|
+
:roles_permissions,
|
9
|
+
:users_permissions,
|
10
|
+
:groups_permissions
|
11
|
+
]
|
12
|
+
|
4
13
|
def setup
|
5
|
-
@permissions = Permission.
|
14
|
+
@permissions = Permission.all
|
6
15
|
end
|
7
16
|
|
8
17
|
def test_company
|
9
18
|
@permissions.each do |x|
|
10
|
-
|
19
|
+
assert_not_nil x.company, "#{x.id} belongs to no companies"
|
11
20
|
end
|
12
21
|
end
|
13
22
|
|
14
23
|
def test_resource
|
15
24
|
@permissions.each do |p|
|
16
|
-
|
25
|
+
assert_not_nil p.resource, "#{p.id} belongs to no resource!"
|
17
26
|
end
|
18
27
|
end
|
19
28
|
|
20
29
|
def test_rigidity
|
21
30
|
# each role must exist!
|
22
|
-
|
23
|
-
|
24
|
-
|
31
|
+
ActiveRecord::Base.connection.execute(
|
32
|
+
"SELECT * from roles_permissions;"
|
33
|
+
).result.each do |res|
|
34
|
+
assert Role.find(res[0])
|
35
|
+
assert Permission.find(res[1])
|
25
36
|
end
|
26
37
|
|
27
38
|
# each user must exist!
|
28
|
-
|
29
|
-
|
30
|
-
|
39
|
+
ActiveRecord::Base.connection.execute(
|
40
|
+
"SELECT * from users_permissions;"
|
41
|
+
).result.each do |res|
|
42
|
+
assert User.find(res[0])
|
43
|
+
assert Permission.find(res[1])
|
44
|
+
end
|
45
|
+
|
46
|
+
# each group must exist!
|
47
|
+
ActiveRecord::Base.connection.execute(
|
48
|
+
"SELECT * from groups_permissions;"
|
49
|
+
).result.each do |res|
|
50
|
+
assert Group.find(res[0])
|
51
|
+
assert Permission.find(res[1])
|
31
52
|
end
|
32
53
|
end
|
33
54
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class ResourceCodeTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:resource_, :resourcecode,
|
6
|
+
]
|
7
|
+
|
4
8
|
def setup
|
5
|
-
@resourcecodes = ResourceCode.
|
9
|
+
@resourcecodes = ResourceCode.all
|
6
10
|
end
|
7
11
|
|
8
12
|
# each resourcecode must belong to a company
|
9
13
|
def test_company
|
10
14
|
@resourcecodes.each do |x|
|
11
|
-
|
15
|
+
assert_not_nil x.company, "#{x.id} belongs to no companies"
|
12
16
|
end
|
13
17
|
end
|
14
18
|
|
15
19
|
# each resourcecode must have a scope
|
16
20
|
def test_scope
|
17
21
|
@resourcecodes.each do |x|
|
18
|
-
|
22
|
+
assert_not_nil x.scope, "#{x.id} has no scope"
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
@@ -23,7 +27,7 @@ class ResourceCodeTest < ActiveSupport::TestCase
|
|
23
27
|
# each resource must exist!
|
24
28
|
resources = @resourcecodes.map{|x| x.resources}.uniq
|
25
29
|
resources.each do |r|
|
26
|
-
|
30
|
+
assert_not_nil r
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
data/test/unit/resource_test.rb
CHANGED
@@ -1,27 +1,42 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class ResourceTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:resource_, :resourcecode,
|
6
|
+
:igimage,
|
7
|
+
:portletpreferences,
|
8
|
+
:mbmessage,
|
9
|
+
:layout,
|
10
|
+
:journalarticle,
|
11
|
+
:bookmarksfolder,
|
12
|
+
:wikinode, :wikipage, :wikipageresource,
|
13
|
+
:announcementsentry,
|
14
|
+
:calevent,
|
15
|
+
:dlfolder, :dlfileentry
|
16
|
+
]
|
17
|
+
|
4
18
|
def setup
|
5
|
-
@resources = Resource.
|
19
|
+
@resources = Resource.all
|
6
20
|
end
|
7
21
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
# # each resource must have a resourcecode
|
23
|
+
# def test_codes
|
24
|
+
# @resources.each do |x|
|
25
|
+
# assert_not_nil x.code, "#{x.id} has no resourcecode"
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# def test_permissions
|
30
|
+
# @resources.each do |x|
|
31
|
+
# permissions = x.permissions
|
32
|
+
# #assert !permissions.empty?, "Resource #{x.id} has no permissions"
|
33
|
+
# permissions.each do |perm|
|
34
|
+
# assert_not_nil perm, "Resource #{x.id} refers to an undefined permission"
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# end
|
24
38
|
|
39
|
+
# NOT ALL TESTS PASS - THE DATABASE MODELING IS INCOMPLETE
|
25
40
|
def test_primkey
|
26
41
|
companies_ids = Company.find(:all).map{|x| x.id.to_s}
|
27
42
|
groups_ids = Group.find(:all).map{|x| x.id.to_s}
|
@@ -30,18 +45,25 @@ class ResourceTest < ActiveSupport::TestCase
|
|
30
45
|
key = x.primkey
|
31
46
|
|
32
47
|
unless (companies_ids.include?(key) or groups_ids.include?(key))
|
33
|
-
|
34
|
-
|
48
|
+
|
49
|
+
# liferay leaves dead resources around,
|
50
|
+
# and the database may still be considered 'sane'
|
51
|
+
begin
|
52
|
+
content = x.content
|
53
|
+
assert_not_nil content, "Resource #{x.id}, primkey #{key} is not any known content type #{x.code.name}"
|
54
|
+
rescue
|
55
|
+
# STDERR.puts $!.message
|
56
|
+
end
|
35
57
|
|
36
58
|
if key[/LAYOUT/]
|
37
|
-
|
38
|
-
|
59
|
+
assert_not_nil x.plid, "Improper LAYOUT resourcecode #{key} for #{x.id}"
|
60
|
+
assert_not_nil x.portletid, "Improper LAYOUT resourcecode #{key} for #{x.id}"
|
39
61
|
|
40
62
|
codename = key[/LAYOUT_([^_]*)/,1]
|
41
|
-
|
42
|
-
|
43
|
-
|
63
|
+
assert_not_nil codename, "Improper LAYOUT resourcecode #{key} for #{x.id}"
|
64
|
+
#assert_equal codename,x.code.name, "Codenames do not match for resource #{x.id}"
|
44
65
|
end
|
66
|
+
|
45
67
|
end
|
46
68
|
end
|
47
69
|
end
|
data/test/unit/role_test.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class RoleTest < ActiveSupport::TestCase
|
4
|
+
fixtures :role_
|
5
|
+
|
4
6
|
def setup
|
5
|
-
@roles = Role.
|
7
|
+
@roles = Role.all
|
6
8
|
end
|
7
9
|
|
8
10
|
# each role must belong to a company
|
9
11
|
def test_company
|
10
12
|
@roles.each do |x|
|
11
|
-
|
13
|
+
assert_not_nil x.company, "#{x.id} belongs to no companies"
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -16,7 +18,7 @@ class RoleTest < ActiveSupport::TestCase
|
|
16
18
|
# each user must exist!
|
17
19
|
users = @roles.map{|x| x.users}.uniq
|
18
20
|
users.each do |user|
|
19
|
-
|
21
|
+
assert_not_nil user
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Tag::AssetTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:tagsasset,
|
6
|
+
:resource_, :resourcecode,
|
7
|
+
:igimage,
|
8
|
+
:mbmessage,
|
9
|
+
:blogsentry,
|
10
|
+
:wikipage,
|
11
|
+
:bookmarksentry,
|
12
|
+
:journalarticle,
|
13
|
+
:dlfileentry
|
14
|
+
]
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@assets = Asset.all
|
18
|
+
end
|
19
|
+
|
20
|
+
# each asset _must_ belong to a company
|
21
|
+
def test_company
|
22
|
+
@assets.each do |asset|
|
23
|
+
assert_not_nil asset.company
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# each asset's resource _must_ belong to a company
|
28
|
+
def test_resource
|
29
|
+
@assets.each do |asset|
|
30
|
+
classname = Classname.find(asset.classnameid).value
|
31
|
+
resource = asset.resource
|
32
|
+
|
33
|
+
assert_not_nil resource.liferay_class, '%s has not defined its Java class' % resource.class
|
34
|
+
assert_equal classname,resource.liferay_class, 'Asset %i' % asset.id
|
35
|
+
|
36
|
+
assert_not_nil resource.company, "Asset's #{asset.id} resource #{resource.id} does not belong to any company"
|
37
|
+
|
38
|
+
assert_equal asset.company,resource.company, "Asset #{asset.id} and resource #{resource.id} belong to a different company"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_asset_types
|
43
|
+
Asset.resource_types.each do |type|
|
44
|
+
type.find(:all).each do |obj|
|
45
|
+
if defined? obj.asset
|
46
|
+
assert_not_nil obj.asset
|
47
|
+
|
48
|
+
# problems with versioned wiki and journal pages..
|
49
|
+
unless obj.class==Wiki::Page or obj.class==Journal::Article
|
50
|
+
assert_equal obj,obj.asset.resource
|
51
|
+
end
|
52
|
+
else
|
53
|
+
#STDERR.puts '%s has not defined the asset method!' % obj.class
|
54
|
+
end
|
55
|
+
|
56
|
+
assert_not_nil obj.liferay_class, '%s has not defined its Java class' % obj.class
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/test/unit/tag/entry_test.rb
CHANGED
@@ -1,34 +1,44 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class Tag::EntryTest < ActiveSupport::TestCase
|
4
|
+
fixtures :tagsentry, :tagsproperty, :tagsasset
|
5
|
+
|
4
6
|
def setup
|
5
|
-
@tags = Tag.find :all
|
7
|
+
@tags = Tag::Entry.find :all
|
6
8
|
end
|
7
9
|
|
8
10
|
def test_name
|
9
11
|
@tags.each do |x|
|
10
|
-
|
12
|
+
assert_not_nil x.name, "#{x.id} has no name"
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
# each tag must belong to a company
|
15
17
|
def test_company
|
16
18
|
@tags.each do |x|
|
17
|
-
|
19
|
+
assert_not_nil x.company, "#{x.id} (#{x.name}) belongs to no company"
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
23
|
def test_owner
|
22
24
|
@tags.each do |x|
|
23
|
-
|
25
|
+
assert_not_nil x.owner, "#{x.id} (#{x.name}) belongs to no user"
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
# each asset must exist
|
29
|
+
# each asset must exist
|
28
30
|
def test_asset
|
29
31
|
assets = @tags.map{|x| x.assets}.uniq
|
30
32
|
assets.each do |asset|
|
31
|
-
|
33
|
+
assert_not_nil asset, "Reference to non-existing asset #{asset.inspect}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_properties
|
38
|
+
@tags.each do |tag|
|
39
|
+
tag.properties.each do |p|
|
40
|
+
assert_equal tag,p.tag
|
41
|
+
end
|
32
42
|
end
|
33
43
|
end
|
34
44
|
|
@@ -1,27 +1,35 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class Tag::PropertyTest < ActiveSupport::TestCase
|
4
|
+
fixtures :tagsentry, :tagsproperty
|
5
|
+
|
4
6
|
def setup
|
5
7
|
@properties = Tag::Property.find :all
|
6
8
|
end
|
7
9
|
|
8
10
|
def test_company
|
9
11
|
@properties.each do |x|
|
10
|
-
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no companies"
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_owner
|
15
17
|
@properties.each do |x|
|
16
|
-
|
18
|
+
assert_not_nil x.owner, "#{x.id} belongs to no user"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_tags
|
23
|
+
@properties.each do |p|
|
24
|
+
assert p.tag.properties.include?(p)
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
20
28
|
def test_rigidity
|
21
|
-
# each asset must exist
|
29
|
+
# each asset must exist
|
22
30
|
tags = @properties.map{|x| x.tag}.uniq
|
23
31
|
tags.each do |tag|
|
24
|
-
|
32
|
+
assert_not_nil tag, "Reference to non-existing tag #{tag.inspect}"
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
data/test/unit/user_test.rb
CHANGED
@@ -1,66 +1,74 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class UserTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:organization_,
|
6
|
+
:contact_
|
7
|
+
]
|
4
8
|
|
5
9
|
def setup
|
6
|
-
@users = User.
|
7
|
-
end
|
8
|
-
|
9
|
-
# each user must have an account
|
10
|
-
def test_account
|
11
|
-
@users.each do |x|
|
12
|
-
# in the default liferay 5.0.1 DB, lax95 has no account
|
13
|
-
#assert !x.account.nil?, "#{x.screenname} has no account"
|
14
|
-
end
|
10
|
+
@users = User.all
|
15
11
|
end
|
16
12
|
|
17
13
|
# each user must belong to a company
|
18
14
|
def test_company
|
19
15
|
@users.each do |x|
|
20
|
-
|
16
|
+
assert_not_nil x.company
|
21
17
|
end
|
22
18
|
end
|
23
19
|
|
24
|
-
# each user can belong to many organizations
|
20
|
+
# each user can belong to many organizations (they don't have to)
|
25
21
|
def test_organization
|
26
22
|
@users.each do |x|
|
27
|
-
|
28
|
-
|
23
|
+
x.organizations.each do |o|
|
24
|
+
assert_not_nil o
|
29
25
|
end
|
26
|
+
#assert !x.organizations.empty?, "#{x.screenname} belongs to no organizations"
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
33
30
|
# each user must have a contact
|
34
31
|
def test_contact
|
35
32
|
@users.each do |x|
|
36
|
-
|
33
|
+
assert_not_nil x.contact
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
40
37
|
def test_fullname
|
41
38
|
@users.each do |x|
|
42
|
-
|
39
|
+
assert_not_nil x.fullname unless x.is_default?
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
46
|
-
|
43
|
+
def test_sex
|
44
|
+
@users.each do |x|
|
45
|
+
assert_not_nil x.sex
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# each user can have a personal group (hive)
|
47
50
|
def test_hive
|
48
51
|
@users.each do |x|
|
49
52
|
group = x.hive
|
50
|
-
|
53
|
+
if group
|
54
|
+
# the group must have a proper classnameid
|
55
|
+
_class = Classname.find_by_value x.liferay_class
|
56
|
+
assert_not_nil _class
|
57
|
+
assert_equal _class.id, group.classnameid, "#{x.id}'s personal group is not assigned to #{x.liferay_class}"
|
51
58
|
|
52
|
-
|
53
|
-
assert group.classnameid == 10034, "User's personal group is not assigned to com.liferay.portal.model.User"
|
59
|
+
assert_not_nil group.friendlyurl
|
54
60
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
61
|
+
# if user is active, hive is active, and vice versa
|
62
|
+
if x.is_active?
|
63
|
+
assert group.is_active?, "#{x.id}'s personal group is not active"
|
64
|
+
# there has to be layoutsets
|
65
|
+
assert !group.layoutsets.empty?, "#{x.id}'s personal group does not have layoutsets"
|
60
66
|
|
61
|
-
|
62
|
-
|
67
|
+
# ..except that Liferay-5.1.x doesn't seem to unactive the group
|
68
|
+
else
|
69
|
+
#assert !group.is_active?, "#{x.id}'s personal group is active, while the user is not"
|
63
70
|
|
71
|
+
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
@@ -69,35 +77,20 @@ class UserTest < ActiveSupport::TestCase
|
|
69
77
|
# each group must exist!
|
70
78
|
groups = @users.map{|x| x.groups}.uniq
|
71
79
|
groups.each do |group|
|
72
|
-
|
80
|
+
assert_not_nil group, "Reference to non-existing group #{group.inspect}"
|
73
81
|
end
|
74
82
|
|
75
83
|
# each role must exist!
|
76
84
|
roles = @users.map{|x| x.roles}.uniq
|
77
85
|
roles.each do |role|
|
78
|
-
|
86
|
+
assert_not_nil role, "Reference to non-existing role #{role.inspect}"
|
79
87
|
end
|
80
88
|
|
81
89
|
# each permission must exist!
|
82
90
|
perms = @users.map{|x| x.permissions}.uniq
|
83
91
|
perms.each do |p|
|
84
|
-
|
92
|
+
assert_not_nil p, "Reference to non-existing permission #{p.inspect}"
|
85
93
|
end
|
86
94
|
end
|
87
95
|
|
88
|
-
# # each user must have a friendlyurl
|
89
|
-
# def test_friendlyurl
|
90
|
-
# @users.each do |x|
|
91
|
-
# assert !x.friendlyurl.nil?
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
|
95
|
-
|
96
|
-
# # test that user has subscribed tags
|
97
|
-
# def test_subscriptions
|
98
|
-
# tags = @mikael.subscriptions
|
99
|
-
# assert tags.include?(@vitamins)
|
100
|
-
# assert tags.include?(@dieting)
|
101
|
-
# end
|
102
|
-
|
103
96
|
end
|
data/test/unit/usergroup_test.rb
CHANGED
@@ -1,31 +1,32 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class UsergroupTest < ActiveSupport::TestCase
|
4
|
+
fixtures :usergroup
|
5
|
+
|
4
6
|
def setup
|
5
|
-
@usergroups =
|
6
|
-
assert !@usergroups.empty?, "No usergroups"
|
7
|
+
@usergroups = Usergroup.all
|
7
8
|
end
|
8
9
|
|
9
10
|
# each usergroup must belong to a company
|
10
11
|
def test_company
|
11
12
|
@usergroups.each do |x|
|
12
|
-
|
13
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
# each usergroup must belong to a company
|
17
18
|
def test_parent
|
18
19
|
@usergroups.each do |x|
|
19
|
-
unless x.
|
20
|
-
|
20
|
+
unless x.parentusergroupid == 0
|
21
|
+
assert_not_nil x.parent, "#{x.id} has no parent"
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
def
|
26
|
+
def test_groups
|
26
27
|
@usergroups.each do |x|
|
27
|
-
x.
|
28
|
-
|
28
|
+
x.groups.each do |group|
|
29
|
+
assert_not_nil group, "#{x.id} has_and_belongs_to an unknown group"
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|