sys-admin 1.5.3-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +112 -0
- data/MANIFEST +14 -0
- data/README +156 -0
- data/Rakefile +74 -0
- data/doc/sys-admin-unix.txt +164 -0
- data/doc/sys-admin-windows.txt +336 -0
- data/examples/groups.rb +39 -0
- data/examples/users.rb +53 -0
- data/lib/sys/admin.rb +980 -0
- data/sys-admin.gemspec +28 -0
- data/test/test_sys_admin.rb +21 -0
- data/test/test_sys_admin_unix.rb +245 -0
- data/test/test_sys_admin_windows.rb +333 -0
- metadata +112 -0
data/sys-admin.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Do not use this file directly. Build the gem via the Rake tasks.
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'sys-admin'
|
7
|
+
spec.version = '1.5.3'
|
8
|
+
spec.author = 'Daniel J. Berger'
|
9
|
+
spec.license = 'Artistic 2.0'
|
10
|
+
spec.email = 'djberg96@gmail.com'
|
11
|
+
spec.homepage = 'http://www.github.com/djberg96/sysutils'
|
12
|
+
spec.summary = 'A unified, cross platform replacement for the "etc" library.'
|
13
|
+
spec.test_file = 'test/test_sys_admin.rb'
|
14
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
15
|
+
|
16
|
+
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
17
|
+
spec.rubyforge_project = 'sysutils'
|
18
|
+
|
19
|
+
spec.add_development_dependency('test-unit', '>= 2.1.1')
|
20
|
+
|
21
|
+
spec.description = <<-EOF
|
22
|
+
The sys-admin library is a unified, cross platform replacement for the
|
23
|
+
'etc' library that ships as part of the Ruby standard library. It
|
24
|
+
provides a common interface for all platforms, including MS Windows. In
|
25
|
+
addition, it provides an interface for adding, deleting and configuring
|
26
|
+
users on MS Windows.
|
27
|
+
EOF
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# test_sys_admin.rb
|
3
|
+
#
|
4
|
+
# This exists mostly for the sake of the gemspec, so that it calls the right
|
5
|
+
# test suite based on the platform.
|
6
|
+
###############################################################################
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'test-unit'
|
9
|
+
require 'test/unit'
|
10
|
+
|
11
|
+
if File::ALT_SEPARATOR
|
12
|
+
require 'test_sys_admin_windows'
|
13
|
+
else
|
14
|
+
require 'test_sys_admin_unix'
|
15
|
+
end
|
16
|
+
|
17
|
+
class TC_Sys_Admin_All < Test::Unit::TestCase
|
18
|
+
def test_version
|
19
|
+
assert_equal('1.5.3', Sys::Admin::VERSION)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,245 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# test_sys_admin_unix.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Unix version of sys-admin. This test should be run
|
5
|
+
# via the 'rake test' task.
|
6
|
+
###############################################################################
|
7
|
+
require 'test/unit'
|
8
|
+
require 'sys/admin'
|
9
|
+
include Sys
|
10
|
+
|
11
|
+
class TC_Sys_Admin_Unix < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@user = 'nobody'
|
14
|
+
@user_id = 0
|
15
|
+
@group = 'sys'
|
16
|
+
@group_id = 3
|
17
|
+
end
|
18
|
+
|
19
|
+
## Admin singleton methods
|
20
|
+
|
21
|
+
def test_get_login
|
22
|
+
assert_respond_to(Admin, :get_login)
|
23
|
+
assert_nothing_raised{ Admin.get_login }
|
24
|
+
assert_kind_of(String, Admin.get_login)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_get_user_basic
|
28
|
+
assert_respond_to(Admin, :get_user)
|
29
|
+
assert_nothing_raised{ Admin.get_user(@user) }
|
30
|
+
assert_nothing_raised{ Admin.get_user(@user_id) }
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_get_user_by_name
|
34
|
+
assert_kind_of(User, Admin.get_user(@user))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_get_user_by_id
|
38
|
+
assert_kind_of(User, Admin.get_user(@user_id))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_get_user_expected_errors
|
42
|
+
assert_raise(ArgumentError){ Admin.get_user }
|
43
|
+
assert_raise(TypeError){ Admin.get_user([]) }
|
44
|
+
assert_raise(Admin::Error){ Admin.get_user('foofoofoo') }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_users_basic
|
48
|
+
assert_respond_to(Admin, :users)
|
49
|
+
assert_nothing_raised{ Admin.users }
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_users
|
53
|
+
assert_kind_of(Array, Admin.users)
|
54
|
+
assert_kind_of(User, Admin.users.first)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_users_block_form
|
58
|
+
array = []
|
59
|
+
assert_nothing_raised{ Admin.users{ |g| array << g } }
|
60
|
+
assert_equal(true, Admin.users.length == array.length)
|
61
|
+
assert_nothing_raised{ Admin.users{ |g| break } }
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_users_expected_errors
|
65
|
+
assert_raise(ArgumentError){ Admin.users(@user_id) }
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_get_group_basic
|
69
|
+
assert_respond_to(Admin, :get_group)
|
70
|
+
assert_nothing_raised{ Admin.get_group(@group) }
|
71
|
+
assert_nothing_raised{ Admin.get_group(@group_id) }
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_get_group_by_name
|
75
|
+
assert_kind_of(Group, Admin.get_group(@group))
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_get_group_by_id
|
79
|
+
assert_kind_of(Group, Admin.get_group(@group_id))
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_get_group_expected_errors
|
83
|
+
assert_raise(ArgumentError){ Admin.get_group }
|
84
|
+
assert_raise(TypeError){ Admin.get_group([]) }
|
85
|
+
assert_raise(Admin::Error){ Admin.get_group('foofoofoo') }
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_groups_basic
|
89
|
+
assert_respond_to(Admin, :groups)
|
90
|
+
assert_nothing_raised{ Admin.groups }
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_groups
|
94
|
+
assert_kind_of(Array, Admin.groups)
|
95
|
+
assert_kind_of(Group, Admin.groups.first)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_groups_expected_errors
|
99
|
+
assert_raise(ArgumentError){ Admin.groups(@group_id) }
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_groups_block_form
|
103
|
+
array = []
|
104
|
+
assert_nothing_raised{ Admin.groups{ |g| array << g } }
|
105
|
+
assert_equal(true, Admin.groups.length == array.length)
|
106
|
+
assert_nothing_raised{ Admin.groups{ |g| break } }
|
107
|
+
end
|
108
|
+
|
109
|
+
## User Tests
|
110
|
+
|
111
|
+
def test_user_name
|
112
|
+
@user = Admin.users.first
|
113
|
+
assert_respond_to(@user, :name)
|
114
|
+
assert_kind_of(String, @user.name)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_user_passwd
|
118
|
+
@user = Admin.users.first
|
119
|
+
assert_respond_to(@user, :passwd)
|
120
|
+
assert_kind_of(String, @user.passwd)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_user_uid
|
124
|
+
@user = Admin.users.first
|
125
|
+
assert_respond_to(@user, :uid)
|
126
|
+
assert_kind_of(Fixnum, @user.uid)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_user_gid
|
130
|
+
@user = Admin.users.first
|
131
|
+
assert_respond_to(@user, :gid)
|
132
|
+
assert_kind_of(Fixnum, @user.gid)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_user_dir
|
136
|
+
@user = Admin.users.first
|
137
|
+
assert_respond_to(@user, :dir)
|
138
|
+
assert_kind_of(String, @user.dir)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_user_shell
|
142
|
+
@user = Admin.users.first
|
143
|
+
assert_respond_to(@user, :shell)
|
144
|
+
assert_kind_of(String, @user.shell)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_user_gecos
|
148
|
+
@user = Admin.users.first
|
149
|
+
assert_respond_to(@user, :gecos)
|
150
|
+
assert_kind_of(String, @user.gecos)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_user_quota
|
154
|
+
@user = Admin.users.first
|
155
|
+
assert_respond_to(@user, :quota)
|
156
|
+
assert_true([Fixnum, NilClass].include?(@user.quota.class))
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_user_age
|
160
|
+
@user = Admin.users.first
|
161
|
+
assert_respond_to(@user, :age)
|
162
|
+
assert_true([Fixnum, NilClass].include?(@user.age.class))
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_user_access_class
|
166
|
+
@user = Admin.users.first
|
167
|
+
assert_respond_to(@user, :access_class)
|
168
|
+
assert_true([String, NilClass].include?(@user.access_class.class))
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_user_comment
|
172
|
+
@user = Admin.users.first
|
173
|
+
assert_respond_to(@user, :comment)
|
174
|
+
assert_true([String, NilClass].include?(@user.comment.class))
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_user_expire
|
178
|
+
@user = Admin.users.first
|
179
|
+
assert_respond_to(@user, :expire)
|
180
|
+
assert_true([Time, NilClass].include?(@user.expire.class))
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_user_change
|
184
|
+
@user = Admin.users.first
|
185
|
+
assert_respond_to(@user, :change)
|
186
|
+
assert_true([Time, NilClass].include?(@user.change.class))
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_user_login_time
|
190
|
+
@user = Admin.users.first
|
191
|
+
assert_respond_to(@user, :login_time)
|
192
|
+
assert_true([Time, NilClass].include?(@user.login_time.class))
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_user_login_device
|
196
|
+
@user = Admin.users.first
|
197
|
+
assert_respond_to(@user, :login_device)
|
198
|
+
assert_true([String, NilClass].include?(@user.login_device.class))
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_user_login_host
|
202
|
+
@user = Admin.users.first
|
203
|
+
assert_respond_to(@user, :login_host)
|
204
|
+
assert_true([String, NilClass].include?(@user.login_host.class))
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_user_groups
|
208
|
+
@user = Admin.users.first
|
209
|
+
assert_respond_to(@user, :groups)
|
210
|
+
assert_kind_of(Array, @user.groups)
|
211
|
+
end
|
212
|
+
|
213
|
+
## Group Tests
|
214
|
+
|
215
|
+
def test_group_name
|
216
|
+
@group = Admin.groups.first
|
217
|
+
assert_respond_to(@group, :name)
|
218
|
+
assert_kind_of(String, @group.name)
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_group_gid
|
222
|
+
@group = Admin.groups.first
|
223
|
+
assert_respond_to(@group, :gid)
|
224
|
+
assert_kind_of(Fixnum, @group.gid)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_group_members
|
228
|
+
@group = Admin.groups.first
|
229
|
+
assert_respond_to(@group, :members)
|
230
|
+
assert_kind_of(Array, @group.members)
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_group_passwd
|
234
|
+
@group = Admin.groups.first
|
235
|
+
assert_respond_to(@group, :passwd)
|
236
|
+
assert_kind_of(String, @group.passwd)
|
237
|
+
end
|
238
|
+
|
239
|
+
def teardown
|
240
|
+
@user = nil
|
241
|
+
@user_id = nil
|
242
|
+
@group = nil
|
243
|
+
@group_id = nil
|
244
|
+
end
|
245
|
+
end
|
@@ -0,0 +1,333 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# test_sys_admin_windows.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Win32 version of sys-admin. Note that some of the tests
|
5
|
+
# are numbered to ensure a certain order. That way I can add test users
|
6
|
+
# before configuring or deleting them.
|
7
|
+
#
|
8
|
+
# It is assumed that this test will be run via the 'rake test' task.
|
9
|
+
###############################################################################
|
10
|
+
require 'rubygems'
|
11
|
+
gem 'test-unit'
|
12
|
+
|
13
|
+
require 'test/unit'
|
14
|
+
require 'sys/admin'
|
15
|
+
require 'socket'
|
16
|
+
include Sys
|
17
|
+
|
18
|
+
class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
19
|
+
def self.startup
|
20
|
+
@@host = Socket.gethostname
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup
|
24
|
+
@user = User.new
|
25
|
+
@user_name = 'Guest'
|
26
|
+
@user_id = 501 # best guess, may fail
|
27
|
+
@group = Group.new
|
28
|
+
@group_name = 'Guests'
|
29
|
+
@group_id = 546 # best guess, may fail
|
30
|
+
end
|
31
|
+
|
32
|
+
# Admin singleton methods
|
33
|
+
|
34
|
+
def test_01_add_user
|
35
|
+
assert_respond_to(Admin, :add_user)
|
36
|
+
assert_nothing_raised{
|
37
|
+
Admin.add_user(:name => 'foo', :password => 'a1b2c3D4')
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_02_config_user
|
42
|
+
assert_respond_to(Admin, :configure_user)
|
43
|
+
assert_nothing_raised{
|
44
|
+
Admin.configure_user(
|
45
|
+
:name => 'foo',
|
46
|
+
:description => 'delete me',
|
47
|
+
:fullname => 'fubar',
|
48
|
+
:password => ['a1b2c3D4', 'd1c2b3A4']
|
49
|
+
)
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_03_delete_user
|
54
|
+
assert_respond_to(Admin, :delete_user)
|
55
|
+
assert_nothing_raised{ Admin.delete_user('foo') }
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_01_add_group
|
59
|
+
assert_respond_to(Admin, :add_group)
|
60
|
+
assert_nothing_raised{ Admin.add_group(:name => 'bar') }
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_02_configure_group
|
64
|
+
assert_respond_to(Admin, :configure_group)
|
65
|
+
assert_nothing_raised{
|
66
|
+
Admin.configure_group(:name => 'bar', :description => 'delete me')
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_03_delete_group
|
71
|
+
assert_respond_to(Admin, :delete_group)
|
72
|
+
assert_nothing_raised{ Admin.delete_group('bar') }
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_get_login_basic
|
76
|
+
assert_respond_to(Admin, :get_login)
|
77
|
+
assert_nothing_raised{ Admin.get_login }
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_get_login
|
81
|
+
assert_kind_of(String, Admin.get_login)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_get_login_expected_errors
|
85
|
+
assert_raise(ArgumentError){ Admin.get_login('foo') }
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_get_user_basic
|
89
|
+
assert_respond_to(Admin, :get_user)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_get_user_by_string
|
93
|
+
assert_nothing_raised{ Admin.get_user(@user_name, :localaccount => true) }
|
94
|
+
assert_kind_of(User, Admin.get_user(@user_name, :localaccount => true))
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_get_user_by_uid
|
98
|
+
assert_nothing_raised{ Admin.get_user(@user_id, :localaccount => true) }
|
99
|
+
assert_kind_of(User, Admin.get_user(@user_id, :localaccount => true))
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_get_user_by_string_with_options
|
103
|
+
options = {:host => @@host, :localaccount => true}
|
104
|
+
assert_nothing_raised{ Admin.get_user(@user_name, options) }
|
105
|
+
assert_kind_of(User, Admin.get_user(@user_name, options))
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_get_user_by_uid_with_options
|
109
|
+
options = {:host => @@host, :localaccount => true}
|
110
|
+
assert_nothing_raised{ Admin.get_user(@user_id, options) }
|
111
|
+
assert_kind_of(User, Admin.get_user(@user_id, options))
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_get_user_expected_errors
|
115
|
+
assert_raises(ArgumentError){ Admin.get_user }
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_users_basic
|
119
|
+
assert_respond_to(Admin, :users)
|
120
|
+
assert_nothing_raised{ Admin.users(:localaccount => true) }
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_users
|
124
|
+
assert_kind_of(Array, Admin.users(:localaccount => true))
|
125
|
+
assert_kind_of(User, Admin.users(:localaccount => true).first)
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_users_with_block
|
129
|
+
array = []
|
130
|
+
assert_nothing_raised{
|
131
|
+
Admin.users(:localaccount => true){ |u| array << u }
|
132
|
+
}
|
133
|
+
assert_kind_of(User, array[0])
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_get_group_basic
|
137
|
+
assert_respond_to(Admin, :get_group)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_get_group_by_name
|
141
|
+
assert_nothing_raised{ Admin.get_group(@group_name, :localaccount => true) }
|
142
|
+
assert_kind_of(Group, Admin.get_group(@group_name, :localaccount => true))
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_get_group_by_gid
|
146
|
+
assert_nothing_raised{ Admin.get_group(@group_id, :localaccount => true) }
|
147
|
+
assert_kind_of(Group, Admin.get_group(@group_id, :localaccount => true))
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_get_group_with_options
|
151
|
+
assert_nothing_raised{ Admin.get_group(@group_name, :localaccount => true) }
|
152
|
+
assert_kind_of(Group, Admin.get_group(@group_name, :localaccount => true))
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_get_group_expected_errors
|
156
|
+
assert_raise(ArgumentError){ Admin.get_group }
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_groups_basic
|
160
|
+
assert_respond_to(Admin, :groups)
|
161
|
+
assert_nothing_raised{ Admin.groups(:localaccount => true) }
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_groups
|
165
|
+
assert_kind_of(Array, Admin.groups(:localaccount => true))
|
166
|
+
assert_kind_of(Group, Admin.groups(:localaccount => true).first)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_groups_with_block
|
170
|
+
array = []
|
171
|
+
assert_nothing_raised{
|
172
|
+
Admin.groups(:localaccount => true){ |g| array << g }
|
173
|
+
}
|
174
|
+
assert_kind_of(Group, array[0])
|
175
|
+
end
|
176
|
+
|
177
|
+
# User class
|
178
|
+
|
179
|
+
def test_user_instance_caption
|
180
|
+
assert_respond_to(@user, :caption)
|
181
|
+
assert_respond_to(@user, :caption=)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_user_instance_description
|
185
|
+
assert_respond_to(@user, :description)
|
186
|
+
assert_respond_to(@user, :description=)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_user_instance_domain
|
190
|
+
assert_respond_to(@user, :domain)
|
191
|
+
assert_respond_to(@user, :domain=)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_user_instance_password
|
195
|
+
assert_respond_to(@user, :password)
|
196
|
+
assert_respond_to(@user, :password=)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_user_instance_full_name
|
200
|
+
assert_respond_to(@user, :full_name)
|
201
|
+
assert_respond_to(@user, :full_name=)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_user_instance_name
|
205
|
+
assert_respond_to(@user, :name)
|
206
|
+
assert_respond_to(@user, :name=)
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_user_instance_sid
|
210
|
+
assert_respond_to(@user, :sid)
|
211
|
+
assert_respond_to(@user, :sid=)
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_user_instance_status
|
215
|
+
assert_respond_to(@user, :status)
|
216
|
+
assert_respond_to(@user, :status=)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_user_instance_disabled
|
220
|
+
assert_respond_to(@user, :disabled?)
|
221
|
+
assert_respond_to(@user, :disabled=)
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_user_instance_local
|
225
|
+
assert_respond_to(@user, :local?)
|
226
|
+
assert_respond_to(@user, :local=)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_user_instance_lockout
|
230
|
+
assert_respond_to(@user, :lockout?)
|
231
|
+
assert_respond_to(@user, :lockout=)
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_user_instance_password_changeable
|
235
|
+
assert_respond_to(@user, :password_changeable?)
|
236
|
+
assert_respond_to(@user, :password_changeable=)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_user_instance_password_expires
|
240
|
+
assert_respond_to(@user, :password_expires?)
|
241
|
+
assert_respond_to(@user, :password_expires=)
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_user_instance_password_required
|
245
|
+
assert_respond_to(@user, :password_required?)
|
246
|
+
assert_respond_to(@user, :password_required=)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_user_instance_account_type
|
250
|
+
assert_respond_to(@user, :account_type)
|
251
|
+
assert_respond_to(@user, :account_type=)
|
252
|
+
end
|
253
|
+
|
254
|
+
def test_user_instance_uid
|
255
|
+
assert_respond_to(@user, :uid)
|
256
|
+
assert_respond_to(@user, :uid=)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_user_dir_basic
|
260
|
+
assert_respond_to(@user, :dir)
|
261
|
+
assert_respond_to(@user, :dir=)
|
262
|
+
end
|
263
|
+
|
264
|
+
def test_user_dir
|
265
|
+
assert_nothing_raised{ @user = Admin.get_user(@user_name, :localaccount => true) }
|
266
|
+
assert_kind_of([String, NilClass], @user.dir)
|
267
|
+
end
|
268
|
+
|
269
|
+
# Group class
|
270
|
+
|
271
|
+
def test_group_instance_caption
|
272
|
+
assert_respond_to(@group, :caption)
|
273
|
+
assert_respond_to(@group, :caption=)
|
274
|
+
end
|
275
|
+
|
276
|
+
def test_group_instance_description
|
277
|
+
assert_respond_to(@group, :description)
|
278
|
+
assert_respond_to(@group, :description=)
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_group_instance_domain
|
282
|
+
assert_respond_to(@group, :domain)
|
283
|
+
assert_respond_to(@group, :domain=)
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_group_instance_install_date
|
287
|
+
assert_respond_to(@group, :install_date)
|
288
|
+
assert_respond_to(@group, :install_date=)
|
289
|
+
end
|
290
|
+
|
291
|
+
def test_group_instance_name
|
292
|
+
assert_respond_to(@group, :name)
|
293
|
+
assert_respond_to(@group, :name)
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_group_instance_gid
|
297
|
+
assert_respond_to(@group, :gid)
|
298
|
+
assert_respond_to(@group, :gid=)
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_group_instance_status
|
302
|
+
assert_respond_to(@group, :status)
|
303
|
+
assert_respond_to(@group, :status=)
|
304
|
+
end
|
305
|
+
|
306
|
+
def test_group_instance_sid
|
307
|
+
assert_respond_to(@group, :sid)
|
308
|
+
assert_respond_to(@group, :sid=)
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_group_instance_sid_type
|
312
|
+
assert_respond_to(@group, :sid_type)
|
313
|
+
assert_respond_to(@group, :sid_type=)
|
314
|
+
end
|
315
|
+
|
316
|
+
def test_group_instance_local
|
317
|
+
assert_respond_to(@group, :local?)
|
318
|
+
assert_respond_to(@group, :local=)
|
319
|
+
end
|
320
|
+
|
321
|
+
def teardown
|
322
|
+
@user = nil
|
323
|
+
@user_name = nil
|
324
|
+
@user_id = nil
|
325
|
+
@group = nil
|
326
|
+
@group_name = nil
|
327
|
+
@group_id = nil
|
328
|
+
end
|
329
|
+
|
330
|
+
def self.shutdown
|
331
|
+
@@host = nil
|
332
|
+
end
|
333
|
+
end
|