lportal 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +5 -9
- data/Rakefile +12 -1
- data/db_connection.rb +9 -0
- data/lib/country.rb +5 -0
- data/lib/group.rb +2 -1
- data/lib/web/layout.rb +2 -3
- data/lportal.rb +8 -17
- data/rails_gem_chooser.rb +87 -0
- data/test/unit/account_test.rb +7 -4
- data/test/unit/address_test.rb +22 -1
- data/test/unit/announcement/delivery_test.rb +24 -0
- data/test/unit/announcement/entry_test.rb +4 -2
- data/test/unit/blog_post_test.rb +16 -4
- data/test/unit/bookmark/entry_test.rb +11 -2
- data/test/unit/bookmark/folder_test.rb +20 -2
- data/test/unit/calevent_test.rb +9 -2
- data/test/unit/company_test.rb +93 -29
- data/test/unit/contact_test.rb +12 -5
- data/test/unit/country_test.rb +25 -0
- data/test/unit/dl_file_test.rb +12 -6
- data/test/unit/dl_folder_test.rb +33 -4
- data/test/unit/emailaddress_test.rb +28 -0
- data/test/unit/group_test.rb +54 -27
- data/test/unit/ig/folder_test.rb +4 -2
- data/test/unit/ig/image_test.rb +10 -2
- data/test/unit/image_test.rb +12 -4
- data/test/unit/journal/article_image_test.rb +8 -6
- data/test/unit/journal/article_resource_test.rb +9 -5
- data/test/unit/journal/article_test.rb +24 -17
- data/test/unit/journal/feed_test.rb +31 -4
- data/test/unit/journal/structure_test.rb +31 -4
- data/test/unit/journal/template_test.rb +31 -4
- data/test/unit/mb/category_test.rb +44 -8
- data/test/unit/mb/discussion_test.rb +10 -5
- data/test/unit/mb/message_flag_test.rb +28 -0
- data/test/unit/mb/message_test.rb +22 -13
- data/test/unit/mb/stats_user_test.rb +28 -0
- data/test/unit/mb/thread_test.rb +10 -5
- data/test/unit/organization_test.rb +32 -8
- data/test/unit/permission_test.rb +45 -6
- data/test/unit/phone_test.rb +13 -7
- data/test/unit/poll/question_test.rb +30 -4
- data/test/unit/ratings_stats_test.rb +16 -0
- data/test/unit/release_test.rb +5 -3
- data/test/unit/resource_code_test.rb +5 -2
- data/test/unit/resource_test.rb +40 -19
- data/test/unit/role_test.rb +17 -9
- data/test/unit/social_activity_test.rb +35 -0
- data/test/unit/social_relation_test.rb +29 -0
- data/test/unit/tag/asset_test.rb +29 -15
- data/test/unit/tag/entry_test.rb +14 -4
- data/test/unit/tag/property_test.rb +14 -6
- data/test/unit/user_test.rb +86 -57
- data/test/unit/usergroup_test.rb +8 -5
- data/test/unit/web/layout_set_test.rb +21 -6
- data/test/unit/web/layout_test.rb +51 -20
- data/test/unit/web/portlet_preferences_test.rb +10 -2
- data/test/unit/web/portlet_properties_test.rb +10 -2
- data/test/unit/web/portlet_test.rb +12 -3
- data/test/unit/web/typesettings_test.rb +7 -3
- data/test/unit/wiki/node_test.rb +3 -2
- data/test/unit/wiki/page_test.rb +48 -2
- data/version.rb +1 -1
- metadata +186 -105
data/test/unit/contact_test.rb
CHANGED
@@ -1,23 +1,30 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class ContactTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures :Contact_, :Account_, :Company, :User_
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@contacts = Contact.all
|
8
10
|
assert !@contacts.empty?, "No contacts found"
|
9
11
|
end
|
10
12
|
|
11
|
-
# each company must have an account
|
12
13
|
def test_account
|
13
14
|
@contacts.each do |c|
|
14
|
-
assert_not_nil c.account, "#{c} has no account"
|
15
|
+
assert_not_nil c.account, "#{c.inspect} has no account"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_company
|
20
|
+
@contacts.each do |c|
|
21
|
+
assert_not_nil c.company
|
15
22
|
end
|
16
23
|
end
|
17
24
|
|
18
25
|
def test_user
|
19
26
|
@contacts.each do |c|
|
20
|
-
assert_not_nil c.user, "#{c} has no user"
|
27
|
+
assert_not_nil c.user, "#{c.inspect} has no user"
|
21
28
|
end
|
22
29
|
end
|
23
30
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'test/test_helper'
|
3
|
+
|
4
|
+
class CountryTest < ActiveSupport::TestCase
|
5
|
+
fixtures [
|
6
|
+
:Country
|
7
|
+
]
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@countries = Country.find :all
|
11
|
+
assert @countries.size > 0, 'No countries'
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_countries
|
15
|
+
@countries.each do |x|
|
16
|
+
assert_not_nil x.name
|
17
|
+
assert_not_nil x.a2
|
18
|
+
assert_not_nil x.a3
|
19
|
+
assert_not_nil x.number_
|
20
|
+
assert_not_nil x.idd_
|
21
|
+
assert_not_nil x.active_
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/test/unit/dl_file_test.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class DlFileTest < ActiveSupport::TestCase
|
4
|
-
fixtures [:
|
6
|
+
fixtures [:DLFileEntry, :DLFolder, :Company, :User_, :TagsAsset]
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@files = DlFile.all
|
8
10
|
end
|
9
11
|
|
12
|
+
def test_folder
|
13
|
+
@files.each do |dlf|
|
14
|
+
assert_not_nil dlf.folder
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
10
18
|
def test_company
|
11
19
|
@files.each do |dlf|
|
12
20
|
assert_not_nil dlf.company
|
@@ -28,10 +36,8 @@ class DlFileTest < ActiveSupport::TestCase
|
|
28
36
|
def test_path
|
29
37
|
@files.each do |dlf|
|
30
38
|
assert_not_nil dlf.path
|
39
|
+
assert dlf.path[/#{dlf.folderid}/]
|
40
|
+
assert dlf.path[/#{dlf.name}/]
|
31
41
|
end
|
32
42
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
43
|
end
|
data/test/unit/dl_folder_test.rb
CHANGED
@@ -1,8 +1,37 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class DlFolderTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
fixtures [:DLFileEntry, :DLFolder, :Company, :User_, :Group_]
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@folders = DlFolder.all
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_files
|
13
|
+
@folders.each do |dlf|
|
14
|
+
dlf.files.each do |f|
|
15
|
+
assert_not_nil f
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_company
|
21
|
+
@folders.each do |dlf|
|
22
|
+
assert_not_nil dlf.company
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_user
|
27
|
+
@folders.each do |dlf|
|
28
|
+
assert_not_nil dlf.user
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_group
|
33
|
+
@folders.each do |dlf|
|
34
|
+
assert_not_nil dlf.group
|
35
|
+
end
|
7
36
|
end
|
8
37
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
4
|
+
|
5
|
+
class EmailaddressTest < ActiveSupport::TestCase
|
6
|
+
fixtures [
|
7
|
+
:Company,
|
8
|
+
:User_,
|
9
|
+
:EmailAddress
|
10
|
+
]
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@addrs = Emailaddress.all
|
14
|
+
flunk 'No addresses to test' unless @addrs.any?
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_company
|
18
|
+
@addrs.each do |x|
|
19
|
+
assert_not_nil x.company
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_user
|
24
|
+
@addrs.each do |x|
|
25
|
+
assert_not_nil x.user
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/test/unit/group_test.rb
CHANGED
@@ -1,26 +1,33 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class GroupTest < ActiveSupport::TestCase
|
4
6
|
fixtures [
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
7
|
+
:Company,
|
8
|
+
:Group_,
|
9
|
+
:User_,
|
10
|
+
:Organization_,
|
11
|
+
:Groups_Orgs,
|
12
|
+
:Users_Groups,
|
13
|
+
:Users_Orgs,
|
14
|
+
:UserGroup,
|
15
|
+
:Role_,
|
16
|
+
:ClassName_,
|
17
|
+
:Release_
|
11
18
|
]
|
12
19
|
# to test asset_viewer_portlet, these are required
|
13
20
|
fixtures << [
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
21
|
+
:Portlet, :portletproperties, :PortletPreferences,
|
22
|
+
:Layout, :LayoutSet,
|
23
|
+
:TagsAsset,
|
24
|
+
:IGImage,
|
25
|
+
:MBMessage,
|
26
|
+
:BlogsEntry,
|
27
|
+
:WikiPage,
|
28
|
+
:BookmarksEntry,
|
29
|
+
:JournalArticle,
|
30
|
+
:DLFileEntry
|
24
31
|
]
|
25
32
|
|
26
33
|
def setup
|
@@ -103,14 +110,28 @@ class GroupTest < ActiveSupport::TestCase
|
|
103
110
|
|
104
111
|
end
|
105
112
|
|
106
|
-
# each group must belong to a company
|
107
113
|
def test_company
|
108
114
|
@groups.each do |x|
|
109
115
|
assert_not_nil x.company
|
110
116
|
end
|
111
117
|
end
|
112
118
|
|
119
|
+
def test_creator
|
120
|
+
@groups.each do |x|
|
121
|
+
assert_not_nil x.creator
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_parent
|
126
|
+
@groups.each do |x|
|
127
|
+
next if x.parentgroupid==0
|
128
|
+
assert_not_nil x.parent
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
113
132
|
def test_organizations
|
133
|
+
flunk mysql_bug if defined?(mysql_bug)
|
134
|
+
|
114
135
|
@groups.each do |x|
|
115
136
|
x.organizations.each do |org|
|
116
137
|
assert_not_nil org
|
@@ -119,6 +140,8 @@ class GroupTest < ActiveSupport::TestCase
|
|
119
140
|
end
|
120
141
|
|
121
142
|
def test_roles
|
143
|
+
flunk mysql_bug if defined?(mysql_bug)
|
144
|
+
|
122
145
|
@groups.each do |x|
|
123
146
|
x.roles.each do |role|
|
124
147
|
assert_not_nil role
|
@@ -127,6 +150,8 @@ class GroupTest < ActiveSupport::TestCase
|
|
127
150
|
end
|
128
151
|
|
129
152
|
def test_permissions
|
153
|
+
flunk mysql_bug if defined?(mysql_bug)
|
154
|
+
|
130
155
|
@groups.each do |x|
|
131
156
|
x.permissions.each do |permission|
|
132
157
|
assert_not_nil permission
|
@@ -135,6 +160,8 @@ class GroupTest < ActiveSupport::TestCase
|
|
135
160
|
end
|
136
161
|
|
137
162
|
def test_usergroups
|
163
|
+
flunk mysql_bug if defined?(mysql_bug)
|
164
|
+
|
138
165
|
@groups.each do |x|
|
139
166
|
x.usergroups.each do |usergroup|
|
140
167
|
assert_not_nil usergroup
|
@@ -220,11 +247,18 @@ class GroupTest < ActiveSupport::TestCase
|
|
220
247
|
|
221
248
|
portletpreferences = group.asset_viewer_portlet
|
222
249
|
assert_equal Web::PortletPreferences, portletpreferences.class
|
223
|
-
assert_not_nil portletpreferences.path(:asset => asset)
|
224
250
|
|
225
251
|
assert_not_nil portletpreferences.layout
|
226
252
|
assert_equal group, portletpreferences.layout.group
|
227
|
-
assert_equal group.
|
253
|
+
assert_equal group.company, portletpreferences.layout.company
|
254
|
+
|
255
|
+
if Lportal::Schema.buildnumber < 5200
|
256
|
+
assert_equal 'tagged_content', portletpreferences.name
|
257
|
+
else
|
258
|
+
assert_equal 'asset_publisher', portletpreferences.name
|
259
|
+
end
|
260
|
+
|
261
|
+
assert_not_nil portletpreferences.path(:asset => asset)
|
228
262
|
|
229
263
|
# 2nd time the portlet should be retrieved from DB
|
230
264
|
group.reload
|
@@ -232,11 +266,4 @@ class GroupTest < ActiveSupport::TestCase
|
|
232
266
|
end
|
233
267
|
end
|
234
268
|
|
235
|
-
# def test_resource
|
236
|
-
# @groups.each do |x|
|
237
|
-
# # assert !x.resource.nil?, "#{x.id} has no resource"
|
238
|
-
# end
|
239
|
-
# end
|
240
|
-
|
241
|
-
|
242
269
|
end
|
data/test/unit/ig/folder_test.rb
CHANGED
data/test/unit/ig/image_test.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class IG::ImageTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures :IGImage, :IGFolder, :Company, :User_, :TagsAsset
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@igimages = IG::Image.all
|
@@ -25,4 +27,10 @@ class IG::ImageTest < ActiveSupport::TestCase
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
30
|
+
def test_asset
|
31
|
+
@igimages.each do |x|
|
32
|
+
assert_not_nil x.asset
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
28
36
|
end
|
data/test/unit/image_test.rb
CHANGED
@@ -1,25 +1,33 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class ImageTest < ActiveSupport::TestCase
|
6
|
+
fixtures [
|
7
|
+
:Image,
|
8
|
+
:IGImage
|
9
|
+
]
|
10
|
+
|
4
11
|
def setup
|
5
12
|
@images = Image.find :all
|
6
13
|
end
|
7
14
|
|
8
15
|
def test_type
|
9
16
|
@images.each do |x|
|
10
|
-
|
17
|
+
assert_not_nil x.type_, "#{x.id} type is null"
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
21
|
def test_dimensions
|
15
22
|
@images.each do |x|
|
16
|
-
|
23
|
+
assert_not_nil x.width
|
24
|
+
assert_not_nil x.height
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
20
28
|
def test_size
|
21
29
|
@images.each do |x|
|
22
|
-
|
30
|
+
assert_not_nil x.size_, "#{x.id} size is null"
|
23
31
|
assert x.size_ > 0, "#{x.id} size is not positive"
|
24
32
|
end
|
25
33
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Journal::ArticleImageTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# fixtures [
|
7
|
+
# :JournalArticle,
|
8
|
+
# :JournalArticleResource,
|
9
|
+
# :TagsAsset
|
10
|
+
# ]
|
9
11
|
end
|
@@ -1,10 +1,15 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Journal::ArticleResourceTest < ActiveSupport::TestCase
|
4
6
|
fixtures [
|
5
|
-
:
|
6
|
-
|
7
|
-
:
|
7
|
+
:Company,
|
8
|
+
# :User_,
|
9
|
+
:Group_,
|
10
|
+
:JournalArticle,
|
11
|
+
:JournalArticleResource,
|
12
|
+
:TagsAsset
|
8
13
|
]
|
9
14
|
|
10
15
|
def setup
|
@@ -29,5 +34,4 @@ class Journal::ArticleResourceTest < ActiveSupport::TestCase
|
|
29
34
|
end
|
30
35
|
end
|
31
36
|
|
32
|
-
|
33
37
|
end
|
@@ -1,19 +1,23 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Journal::ArticleTest < ActiveSupport::TestCase
|
4
6
|
fixtures [
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
7
|
+
:Company,
|
8
|
+
:User_,
|
9
|
+
:Group_,
|
10
|
+
:JournalArticle,
|
11
|
+
:JournalArticleResource,
|
12
|
+
:TagsAsset,
|
13
|
+
:TagsProperty,
|
14
|
+
:Portlet
|
10
15
|
]
|
11
16
|
|
12
17
|
def setup
|
13
18
|
@articles = Journal::Article.all
|
14
19
|
end
|
15
20
|
|
16
|
-
# each article must belong to a company
|
17
21
|
def test_company
|
18
22
|
@articles.each do |x|
|
19
23
|
assert_not_nil x.company, "#{x.id} belongs to no company"
|
@@ -23,12 +27,13 @@ class Journal::ArticleTest < ActiveSupport::TestCase
|
|
23
27
|
def test_group
|
24
28
|
@articles.each do |x|
|
25
29
|
assert_not_nil x.group, "#{x.id} belongs to no group!"
|
30
|
+
assert_equal x.group, x.resource.group
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
|
-
def
|
34
|
+
def test_user
|
30
35
|
@articles.each do |x|
|
31
|
-
assert_not_nil x.
|
36
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
@@ -50,16 +55,18 @@ class Journal::ArticleTest < ActiveSupport::TestCase
|
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
53
|
-
# def test_properties
|
54
|
-
# @articles.each do |x|
|
55
|
-
# assert_not_nil x.properties
|
56
|
-
# assert !x.properties.empty?
|
57
|
-
# end
|
58
|
-
# end
|
59
|
-
|
60
58
|
def test_path
|
61
59
|
@articles.each do |x|
|
62
|
-
|
60
|
+
# path is defined in Lportal::Portlets
|
61
|
+
path = x.path
|
62
|
+
assert_not_nil path
|
63
|
+
assert !path.empty?
|
64
|
+
|
65
|
+
if Lportal::Schema.buildnumber < 5200
|
66
|
+
assert path[/_assetId=#{x.asset.id}/]
|
67
|
+
else
|
68
|
+
assert path[/content\/#{x.asset.resource.id}/]
|
69
|
+
end
|
63
70
|
end
|
64
71
|
end
|
65
72
|
|