lportal 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- 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/ChangeLog
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
= 1.0.
|
2
|
-
-
|
3
|
-
-
|
4
|
-
- comment on running tests from master branch
|
5
|
-
- print lportal version on init
|
6
|
-
- import fixture name postgresql hack to run master tests on 1.0
|
7
|
-
- fix journal article links
|
8
|
-
- using user.full as message.username if message has user
|
9
|
-
- creation of MB::Thread
|
1
|
+
= 1.0.19
|
2
|
+
- Contry model
|
3
|
+
- backports from master branch
|
10
4
|
|
5
|
+
= 1.0.18
|
6
|
+
- backports from master branch
|
11
7
|
|
12
8
|
= 1.0.17
|
13
9
|
- introduced schema versions, automatic detection from the release_ table
|
data/Rakefile
CHANGED
@@ -2,10 +2,21 @@ require 'rake'
|
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
|
5
|
+
ENV['RAILS_GEM_VERSION'] ||= '2.3.8' # FIXME: test suite does not work on older versions!
|
6
|
+
|
7
|
+
def info(msg)
|
8
|
+
STDOUT.puts msg
|
9
|
+
end
|
10
|
+
|
11
|
+
load 'tasks/env.rake'
|
12
|
+
load 'tasks/fixtures.rake'
|
13
|
+
load 'tasks/migrate.rake'
|
14
|
+
load 'tasks/database.rake'
|
15
|
+
|
5
16
|
desc 'Default: run unit tests.'
|
6
17
|
task :default => :test
|
7
18
|
|
8
|
-
desc 'Test the
|
19
|
+
desc 'Test the lportal gem.'
|
9
20
|
Rake::TestTask.new(:test) do |t|
|
10
21
|
t.libs << 'lib'
|
11
22
|
t.pattern = 'test/**/*_test.rb'
|
data/db_connection.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Database
|
4
|
+
env = ENV['LPORTAL_ENV'] # 'test' or 'production' are valid
|
5
|
+
|
6
|
+
# Open database connection
|
7
|
+
database_configuration = YAML.load_file('config/database.yml')
|
8
|
+
ActiveRecord::Base.configurations = database_configuration
|
9
|
+
ActiveRecord::Base.establish_connection(database_configuration[env])
|
data/lib/country.rb
ADDED
data/lib/group.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
# This model represents the user groups (communities) in the lportal database.
|
2
3
|
class Group < ActiveRecord::Base
|
3
4
|
set_table_name :group_
|
@@ -421,4 +422,4 @@ class Group < ActiveRecord::Base
|
|
421
422
|
return portlet.preferences
|
422
423
|
end
|
423
424
|
|
424
|
-
end
|
425
|
+
end
|
data/lib/web/layout.rb
CHANGED
@@ -168,9 +168,8 @@ module Web
|
|
168
168
|
belongs_to :company,
|
169
169
|
:foreign_key => 'companyid'
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
end
|
171
|
+
has_many :resources,
|
172
|
+
:foreign_key => 'primkey'
|
174
173
|
|
175
174
|
def layoutset
|
176
175
|
Web::LayoutSet.find(:first, :conditions => "groupid=#{self.groupid} AND privatelayout=#{self.privatelayout}" )
|
data/lportal.rb
CHANGED
@@ -5,18 +5,6 @@ file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
|
5
5
|
this_dir = File.dirname(File.expand_path(file))
|
6
6
|
|
7
7
|
require File.join(this_dir,'version')
|
8
|
-
def info(msg)
|
9
|
-
msg = 'lportal: %s' % msg
|
10
|
-
STDOUT.puts(msg)
|
11
|
-
end
|
12
|
-
|
13
|
-
info 'version ' + Lportal::VERSION
|
14
|
-
|
15
|
-
# this would be the proper place to load PostgreSQL hacks from 1.2 branch.
|
16
|
-
# fixture hack imported from master branch would be useful while running tests,
|
17
|
-
# however the test framework needs to be loaded before loading the fixture hack.
|
18
|
-
#require File.join(this_dir,'active_record','fixtures.rb')
|
19
|
-
# workaround: load that (^^) in RAILS_ROOT/test/test_helper.rb
|
20
8
|
|
21
9
|
# set the migrations directory for Caterpillar
|
22
10
|
LPORTAL_MIGRATIONS=File.expand_path(
|
@@ -46,14 +34,17 @@ end
|
|
46
34
|
|
47
35
|
# define this database's schema version
|
48
36
|
require File.join(this_dir,'schema')
|
49
|
-
|
50
|
-
|
51
|
-
|
37
|
+
Lportal::Schema.buildnumber =
|
38
|
+
begin
|
39
|
+
Release.current.buildnumber
|
40
|
+
rescue
|
41
|
+
nil
|
42
|
+
end
|
52
43
|
|
53
44
|
msg = 'Using Liferay schema build %i, version %s' % [
|
54
45
|
Lportal::Schema.buildnumber, Lportal::Schema.version]
|
55
46
|
|
56
|
-
puts msg
|
57
|
-
|
58
47
|
defined?(RAILS_DEFAULT_LOGGER) ?
|
59
48
|
RAILS_DEFAULT_LOGGER.info(msg) : STDOUT.puts(msg)
|
49
|
+
|
50
|
+
puts 'ActiveRecord v.%s' % ActiveRecord::VERSION::STRING
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#--
|
3
|
+
# (c) Copyright 2009,2010 Mikael Lammentausta
|
4
|
+
#
|
5
|
+
# See the file MIT-LICENSE included with the distribution for
|
6
|
+
# software license details.
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
# Rails gem chooser.
|
12
|
+
#
|
13
|
+
# Selects RAILS_GEM_VERSION from ENV, or from RAILS_ROOT/config/environment.rb.
|
14
|
+
# Returns nil otherwise.
|
15
|
+
class RailsGemChooser
|
16
|
+
class << self
|
17
|
+
|
18
|
+
def version(config_file=nil)
|
19
|
+
# detect from ENV
|
20
|
+
if ENV['RAILS_GEM_VERSION']
|
21
|
+
return ENV['RAILS_GEM_VERSION']
|
22
|
+
elsif not config_file
|
23
|
+
# load Rails config file
|
24
|
+
if RAILS_ROOT
|
25
|
+
config_file = File.join(
|
26
|
+
File.expand_path(RAILS_ROOT),
|
27
|
+
'config',
|
28
|
+
'environment.rb'
|
29
|
+
)
|
30
|
+
else
|
31
|
+
STDERR.puts 'Could not detect Rails version'
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
# don't attempt to load Rails if building a Rubygem..!
|
36
|
+
if $0[/gem$/] or !File.exist?(config_file)
|
37
|
+
return nil
|
38
|
+
else
|
39
|
+
# read from Rails config file
|
40
|
+
f=File.open(config_file)
|
41
|
+
config = f.read
|
42
|
+
f.close
|
43
|
+
rails_gem_version = config[/^RAILS_GEM_VERSION.*(\d\.\d\.\d)/,1]
|
44
|
+
#STDOUT.puts 'Detected Rails version %s from the config file %s' % [rails_gem_version,config_file]
|
45
|
+
return rails_gem_version
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Load a specific GEM
|
50
|
+
def __load_gem(require_name, gem_name, version)
|
51
|
+
version ? gem(gem_name, '= '+version) : gem(gem_name)
|
52
|
+
begin
|
53
|
+
require require_name
|
54
|
+
rescue LoadError
|
55
|
+
require gem_name
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Either define +rails_gem_version+ or +config_file+
|
60
|
+
def __load(rails_gem_version=nil,config_file=nil)
|
61
|
+
raise 'oops' if config_file and rails_gem_version
|
62
|
+
|
63
|
+
rails_gem_version ||= version(config_file) # also detects ENV['RAILS_GEM_VERSION']
|
64
|
+
|
65
|
+
#STDOUT.puts 'Loading Rails version %s' % rails_gem_version
|
66
|
+
# the gem without underline will be removed in Rails3..
|
67
|
+
#rails_gems = %w{ active_support action_pack active_record }
|
68
|
+
# except that with the underline divider the gem is not found ..
|
69
|
+
#rails_gems = %w{ activesupport actionpack activerecord }
|
70
|
+
|
71
|
+
rails_gems = {
|
72
|
+
# require name gem name
|
73
|
+
"active_support" => "activesupport",
|
74
|
+
"action_pack" => "actionpack",
|
75
|
+
"active_record" => "activerecord"
|
76
|
+
}
|
77
|
+
|
78
|
+
rails_gems.keys.each do |rg_key|
|
79
|
+
__load_gem(rg_key, rails_gems[rg_key], rails_gem_version)
|
80
|
+
end
|
81
|
+
require 'action_controller'
|
82
|
+
|
83
|
+
#STDOUT.puts 'Loaded Rails version %s' % Rails::VERSION::STRING
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
data/test/unit/account_test.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class AccountTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures [:Account_, :Company, :User_]
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@accounts = Account.find :all
|
8
|
-
|
10
|
+
flunk 'No accounts found' unless @accounts.any?
|
9
11
|
end
|
10
12
|
|
11
13
|
def test_company
|
@@ -16,7 +18,8 @@ class AccountTest < ActiveSupport::TestCase
|
|
16
18
|
|
17
19
|
def test_user
|
18
20
|
@accounts.each do |x|
|
19
|
-
|
21
|
+
next if x.send(User.primary_key)==0
|
22
|
+
assert_not_nil x.user, 'Account %i belongs to no user' % x.id
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
data/test/unit/address_test.rb
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class AddressTest < ActiveSupport::TestCase
|
6
|
+
fixtures [:Address, :Company, :User_]
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@addresses = Address.all
|
10
|
+
flunk 'No addresses found' unless @addresses.any?
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_company
|
14
|
+
@addresses.each do |x|
|
15
|
+
assert_not_nil x.company
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_user
|
20
|
+
@addresses.each do |x|
|
21
|
+
next if x.send(User.primary_key)==0
|
22
|
+
assert_not_nil x.user
|
23
|
+
end
|
24
|
+
end
|
4
25
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
4
|
+
|
5
|
+
class Announcement::DeliveryTest < ActiveSupport::TestCase
|
6
|
+
fixtures :Company, :User_, :AnnouncementsDelivery
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@deliveries = Announcement::Delivery.all
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_company
|
13
|
+
@deliveries.each do |x|
|
14
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_user
|
19
|
+
@deliveries.each do |x|
|
20
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Announcement::EntryTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures :Company, :User_, :AnnouncementsEntry
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@announcements = Announcement::Entry.all
|
data/test/unit/blog_post_test.rb
CHANGED
@@ -1,14 +1,26 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class AssetTest < ActiveSupport::TestCase
|
4
6
|
fixtures [
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
7
|
+
:Company,
|
8
|
+
:TagsAsset,
|
9
|
+
:Resource_, :ResourceCode,
|
10
|
+
:BlogsEntry,
|
11
|
+
:User_,
|
12
|
+
:Group_
|
8
13
|
]
|
9
14
|
|
10
15
|
def setup
|
11
16
|
@posts = BlogPost.all
|
17
|
+
flunk 'No posts to test' unless @posts.any?
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_company
|
21
|
+
@posts.each do |p|
|
22
|
+
assert_not_nil p.company
|
23
|
+
end
|
12
24
|
end
|
13
25
|
|
14
26
|
def test_user
|
@@ -1,10 +1,13 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Bookmark::EntryTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures :Company, :User_, :BookmarksEntry, :BookmarksFolder, :TagsAsset
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@bookmarks = Bookmark::Entry.all
|
10
|
+
flunk 'No bookmark entries to test' unless @bookmarks.any?
|
8
11
|
end
|
9
12
|
|
10
13
|
def test_company
|
@@ -25,4 +28,10 @@ class Bookmark::EntryTest < ActiveSupport::TestCase
|
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
31
|
+
def test_asset
|
32
|
+
@bookmarks.each do |x|
|
33
|
+
assert_not_nil x.asset
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
28
37
|
end
|
@@ -1,10 +1,13 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class Bookmark::FolderTest < ActiveSupport::TestCase
|
4
|
-
fixtures :
|
6
|
+
fixtures :Company, :Group_, :User_, :BookmarksEntry, :BookmarksFolder
|
5
7
|
|
6
8
|
def setup
|
7
9
|
@folders = Bookmark::Folder.all
|
10
|
+
flunk 'No bookmark folders to test' unless @folders.any?
|
8
11
|
end
|
9
12
|
|
10
13
|
def test_company
|
@@ -13,10 +16,25 @@ class Bookmark::FolderTest < ActiveSupport::TestCase
|
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
19
|
+
def test_group
|
20
|
+
@folders.each do |x|
|
21
|
+
assert_not_nil x.group
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
16
25
|
def test_user
|
17
26
|
@folders.each do |x|
|
18
27
|
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
28
|
end
|
20
29
|
end
|
21
30
|
|
31
|
+
def test_entries
|
32
|
+
@folders.each do |x|
|
33
|
+
assert_not_nil x.entries
|
34
|
+
x.entries.each do |e|
|
35
|
+
assert_equal x, e.folder
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
22
40
|
end
|
data/test/unit/calevent_test.rb
CHANGED
data/test/unit/company_test.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'test/test_helper'
|
2
4
|
|
3
5
|
class CompanyTest < ActiveSupport::TestCase
|
4
6
|
fixtures [
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
7
|
+
:Company,
|
8
|
+
:User_, :Group_,
|
9
|
+
:Account_, :Organization_, :Contact_,
|
10
|
+
:Layout, :LayoutSet,
|
11
|
+
:Resource_, :ResourceCode,
|
12
|
+
:Role_, :Users_Roles
|
10
13
|
]
|
11
14
|
|
12
15
|
def setup
|
@@ -17,42 +20,37 @@ class CompanyTest < ActiveSupport::TestCase
|
|
17
20
|
# each company must have an account
|
18
21
|
def test_account
|
19
22
|
@companies.each do |c|
|
20
|
-
|
23
|
+
assert_not_nil c.account, "#{c.id} has no account"
|
24
|
+
#assert_equal 0, c.account.send(User.primary_key) #?
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
|
-
#
|
28
|
+
# address is not required, not included in Liferay 5.2.3 dataset
|
29
|
+
# def test_address
|
30
|
+
# @companies.each do |c|
|
31
|
+
# #assert_not_nil c.address, "#{c.id} has no address"
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
|
25
35
|
def test_contacts
|
26
36
|
@companies.each do |c|
|
27
37
|
assert !c.contacts.empty?, "#{c.id} has no contacts"
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
31
|
-
|
32
|
-
# def test_defaultuser
|
33
|
-
# @companies.each do |c|
|
34
|
-
# assert c.account.user.is_default?, "No default user for #{c.id}"
|
35
|
-
# assert c.account.user.is_active?, "Default user account for #{c.id} is not active"
|
36
|
-
# assert c.account.user.company == c, "Default user for #{c.id} has wrong company"
|
37
|
-
# assert !c.account.user.account.nil?, "Default user for #{c.id} has no account"
|
38
|
-
# end
|
39
|
-
# end
|
40
|
-
|
41
|
-
# each company must have a webid
|
42
|
-
def test_webid
|
41
|
+
def test_users
|
43
42
|
@companies.each do |c|
|
44
|
-
|
43
|
+
c.users.each do |u|
|
44
|
+
assert_not_nil u
|
45
|
+
end
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
|
-
def test_virtualhost
|
50
|
-
layoutsets_virtualhosts=Web::LayoutSet.find(:all).map{|s| s.virtualhost }
|
49
|
+
def test_groups
|
51
50
|
@companies.each do |c|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
assert !layoutsets_virtualhosts.include?(c.virtualhost), "Duplicate virtualhost #{c.virtualhost} in layoutsets"
|
51
|
+
c.groups.each do |g|
|
52
|
+
assert_not_nil g
|
53
|
+
end
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
@@ -64,15 +62,37 @@ class CompanyTest < ActiveSupport::TestCase
|
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
65
|
+
def test_layoutsets
|
66
|
+
@companies.each do |c|
|
67
|
+
assert c.layoutsets.any?, 'Company %i has no layoutsets' % c.id
|
68
|
+
c.layoutsets.each do |ls|
|
69
|
+
assert_equal c, ls.company
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# def test_resources
|
75
|
+
# @companies.each do |c|
|
76
|
+
# assert c.resources.any?, 'Company %i has no resources' % c.id
|
77
|
+
# end
|
78
|
+
# end
|
79
|
+
|
67
80
|
def test_administrators
|
68
81
|
@companies.each do |c|
|
82
|
+
adminrole = Role.find(:first, :conditions => "companyid=#{c.id} AND name='Administrator'")
|
83
|
+
assert_not_nil adminrole, 'No admin role found'
|
69
84
|
assert c.administrators.size > 0, 'Company %s (%i) does not have administrators' % [c.webid, c.id]
|
70
85
|
end
|
71
86
|
end
|
72
87
|
|
73
88
|
def test_guest
|
74
89
|
@companies.each do |c|
|
75
|
-
assert_not_nil c.guest, 'Company %
|
90
|
+
assert_not_nil c.guest, 'Company %s does not have a guest account' % c.webid
|
91
|
+
assert c.guest.is_default?, "No default user for #{c.webid}"
|
92
|
+
assert c.guest.is_active?, "Default user account for #{c.webid} is not active"
|
93
|
+
assert c.guest.company == c, "Default user for #{c.webid} has wrong company"
|
94
|
+
# Liferay 5.2.3 has an account for Guest
|
95
|
+
#assert_nil c.guest.account, "Default user for #{c.webid} has an account"
|
76
96
|
end
|
77
97
|
end
|
78
98
|
|
@@ -82,4 +102,48 @@ class CompanyTest < ActiveSupport::TestCase
|
|
82
102
|
end
|
83
103
|
end
|
84
104
|
|
105
|
+
|
106
|
+
def test_personal_groups
|
107
|
+
@companies.each do |c|
|
108
|
+
assert_nothing_raised { c.personal_groups }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_public_groups
|
113
|
+
@companies.each do |c|
|
114
|
+
assert_nothing_raised { c.public_groups }
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_open_groups
|
119
|
+
@companies.each do |c|
|
120
|
+
assert_nothing_raised { c.open_groups }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_private_groups
|
125
|
+
@companies.each do |c|
|
126
|
+
assert_nothing_raised { c.private_groups }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# each company must have a webid
|
132
|
+
def test_webid
|
133
|
+
@companies.each do |c|
|
134
|
+
assert_not_nil c.webid, "#{c.id} has no webid"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# each company must have a virtualhost
|
139
|
+
def test_virtualhost
|
140
|
+
layoutsets_virtualhosts=Web::LayoutSet.find(:all).map{|s| s.virtualhost }
|
141
|
+
@companies.each do |c|
|
142
|
+
assert_not_nil c.virtualhost, "#{c.id} has no virtualhost"
|
143
|
+
|
144
|
+
# check that the virtualhost isn't duplicated in any layoutsets
|
145
|
+
assert !layoutsets_virtualhosts.include?(c.virtualhost), "Duplicate virtualhost #{c.virtualhost} in layoutsets"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
85
149
|
end
|