sys-admin 1.5.5-x86-mingw32 → 1.5.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -1
- data/lib/sys/admin.rb +1 -1
- data/sys-admin.gemspec +1 -1
- data/test/test_sys_admin.rb +1 -1
- data/test/test_sys_admin_windows.rb +49 -41
- metadata +8 -6
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.5.6 - 30-Jul-2011
|
2
|
+
* Fixed issue for non-gnu platforms where it would use the wrong function
|
3
|
+
prototype because the Ruby core team took it upon themselves to explicitly
|
4
|
+
defined _GNU_SOURCE in config.h in 1.8.7 and later for reasons that baffle me.
|
5
|
+
* Some tests on Windows are now skipped unless run with elevated security.
|
6
|
+
|
1
7
|
== 1.5.5 - 5-Jul-2011
|
2
8
|
* Modified lastlog handling, and ignore getpwent_r and getgrent_r, on AIX.
|
3
9
|
Thanks go to Rick Ohnemus for the spot and patches.
|
@@ -39,7 +45,7 @@
|
|
39
45
|
* Added the Group#members method. The returns an array of users that the
|
40
46
|
group contains.
|
41
47
|
* Changed User#class to User#access_class for UNIX flavors to avoid
|
42
|
-
conflicts with the Ruby core Object method.
|
48
|
+
conflicts with the Ruby core Object method.
|
43
49
|
* Added more tests and renamed the test files.
|
44
50
|
* Removed an unnecessary function call where a platform might try to
|
45
51
|
get lastlog information even if the lastlog.h or utmp.h headers couldn't
|
data/lib/sys/admin.rb
CHANGED
data/sys-admin.gemspec
CHANGED
data/test/test_sys_admin.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Test suite for the Win32 version of sys-admin. Note that some of the tests
|
5
5
|
# are numbered to ensure a certain order. That way I can add test users
|
6
6
|
# before configuring or deleting them.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# It is assumed that this test will be run via the 'rake test' task.
|
9
9
|
###############################################################################
|
10
10
|
require 'rubygems'
|
@@ -12,6 +12,7 @@ gem 'test-unit'
|
|
12
12
|
|
13
13
|
require 'test/unit'
|
14
14
|
require 'sys/admin'
|
15
|
+
require 'win32/security'
|
15
16
|
require 'socket'
|
16
17
|
require 'etc'
|
17
18
|
include Sys
|
@@ -19,6 +20,7 @@ include Sys
|
|
19
20
|
class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
20
21
|
def self.startup
|
21
22
|
@@host = Socket.gethostname
|
23
|
+
@@elev = Win32::Security.elevated_security?
|
22
24
|
end
|
23
25
|
|
24
26
|
def setup
|
@@ -33,6 +35,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
33
35
|
# Admin singleton methods
|
34
36
|
|
35
37
|
def test_01_add_user
|
38
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
36
39
|
assert_respond_to(Admin, :add_user)
|
37
40
|
assert_nothing_raised{
|
38
41
|
Admin.add_user(:name => 'foo', :password => 'a1b2c3D4')
|
@@ -40,6 +43,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
40
43
|
end
|
41
44
|
|
42
45
|
def test_02_config_user
|
46
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
43
47
|
assert_respond_to(Admin, :configure_user)
|
44
48
|
assert_nothing_raised{
|
45
49
|
Admin.configure_user(
|
@@ -50,29 +54,33 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
50
54
|
)
|
51
55
|
}
|
52
56
|
end
|
53
|
-
|
57
|
+
|
54
58
|
def test_03_delete_user
|
59
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
55
60
|
assert_respond_to(Admin, :delete_user)
|
56
61
|
assert_nothing_raised{ Admin.delete_user('foo') }
|
57
62
|
end
|
58
63
|
|
59
64
|
def test_01_add_group
|
65
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
60
66
|
assert_respond_to(Admin, :add_group)
|
61
67
|
assert_nothing_raised{ Admin.add_group(:name => 'bar') }
|
62
68
|
end
|
63
|
-
|
69
|
+
|
64
70
|
def test_02_configure_group
|
71
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
65
72
|
assert_respond_to(Admin, :configure_group)
|
66
73
|
assert_nothing_raised{
|
67
74
|
Admin.configure_group(:name => 'bar', :description => 'delete me')
|
68
75
|
}
|
69
76
|
end
|
70
|
-
|
77
|
+
|
71
78
|
def test_03_delete_group
|
79
|
+
omit_unless(@@elev, "insufficient privileges - skipping")
|
72
80
|
assert_respond_to(Admin, :delete_group)
|
73
81
|
assert_nothing_raised{ Admin.delete_group('bar') }
|
74
82
|
end
|
75
|
-
|
83
|
+
|
76
84
|
def test_get_login_basic
|
77
85
|
assert_respond_to(Admin, :get_login)
|
78
86
|
assert_nothing_raised{ Admin.get_login }
|
@@ -85,13 +93,13 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
85
93
|
def test_get_login_expected_errors
|
86
94
|
assert_raise(ArgumentError){ Admin.get_login('foo') }
|
87
95
|
end
|
88
|
-
|
96
|
+
|
89
97
|
def test_get_user_basic
|
90
98
|
assert_respond_to(Admin, :get_user)
|
91
99
|
end
|
92
100
|
|
93
101
|
def test_get_user_by_string
|
94
|
-
assert_nothing_raised{ Admin.get_user(@user_name, :localaccount => true) }
|
102
|
+
assert_nothing_raised{ Admin.get_user(@user_name, :localaccount => true) }
|
95
103
|
assert_kind_of(User, Admin.get_user(@user_name, :localaccount => true))
|
96
104
|
end
|
97
105
|
|
@@ -99,7 +107,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
99
107
|
assert_nothing_raised{ Admin.get_user(@user_id, :localaccount => true) }
|
100
108
|
assert_kind_of(User, Admin.get_user(@user_id, :localaccount => true))
|
101
109
|
end
|
102
|
-
|
110
|
+
|
103
111
|
def test_get_user_by_string_with_options
|
104
112
|
options = {:host => @@host, :localaccount => true}
|
105
113
|
assert_nothing_raised{ Admin.get_user(@user_name, options) }
|
@@ -120,7 +128,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
120
128
|
def test_get_user_expected_errors
|
121
129
|
assert_raises(ArgumentError){ Admin.get_user }
|
122
130
|
end
|
123
|
-
|
131
|
+
|
124
132
|
def test_users_basic
|
125
133
|
assert_respond_to(Admin, :users)
|
126
134
|
assert_nothing_raised{ Admin.users(:localaccount => true) }
|
@@ -142,7 +150,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
142
150
|
def test_get_group_basic
|
143
151
|
assert_respond_to(Admin, :get_group)
|
144
152
|
end
|
145
|
-
|
153
|
+
|
146
154
|
def test_get_group_by_name
|
147
155
|
assert_nothing_raised{ Admin.get_group(@group_name, :localaccount => true) }
|
148
156
|
assert_kind_of(Group, Admin.get_group(@group_name, :localaccount => true))
|
@@ -152,7 +160,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
152
160
|
assert_nothing_raised{ Admin.get_group(@group_id, :localaccount => true) }
|
153
161
|
assert_kind_of(Group, Admin.get_group(@group_id, :localaccount => true))
|
154
162
|
end
|
155
|
-
|
163
|
+
|
156
164
|
def test_get_group_with_options
|
157
165
|
assert_nothing_raised{ Admin.get_group(@group_name, :localaccount => true) }
|
158
166
|
assert_kind_of(Group, Admin.get_group(@group_name, :localaccount => true))
|
@@ -166,7 +174,7 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
166
174
|
def test_get_group_expected_errors
|
167
175
|
assert_raise(ArgumentError){ Admin.get_group }
|
168
176
|
end
|
169
|
-
|
177
|
+
|
170
178
|
def test_groups_basic
|
171
179
|
assert_respond_to(Admin, :groups)
|
172
180
|
assert_nothing_raised{ Admin.groups(:localaccount => true) }
|
@@ -186,77 +194,77 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
186
194
|
end
|
187
195
|
|
188
196
|
# User class
|
189
|
-
|
197
|
+
|
190
198
|
def test_user_instance_caption
|
191
199
|
assert_respond_to(@user, :caption)
|
192
200
|
assert_respond_to(@user, :caption=)
|
193
201
|
end
|
194
|
-
|
202
|
+
|
195
203
|
def test_user_instance_description
|
196
204
|
assert_respond_to(@user, :description)
|
197
205
|
assert_respond_to(@user, :description=)
|
198
206
|
end
|
199
|
-
|
207
|
+
|
200
208
|
def test_user_instance_domain
|
201
209
|
assert_respond_to(@user, :domain)
|
202
210
|
assert_respond_to(@user, :domain=)
|
203
211
|
end
|
204
|
-
|
212
|
+
|
205
213
|
def test_user_instance_password
|
206
214
|
assert_respond_to(@user, :password)
|
207
215
|
assert_respond_to(@user, :password=)
|
208
216
|
end
|
209
|
-
|
217
|
+
|
210
218
|
def test_user_instance_full_name
|
211
219
|
assert_respond_to(@user, :full_name)
|
212
220
|
assert_respond_to(@user, :full_name=)
|
213
221
|
end
|
214
|
-
|
222
|
+
|
215
223
|
def test_user_instance_name
|
216
224
|
assert_respond_to(@user, :name)
|
217
225
|
assert_respond_to(@user, :name=)
|
218
226
|
end
|
219
|
-
|
227
|
+
|
220
228
|
def test_user_instance_sid
|
221
229
|
assert_respond_to(@user, :sid)
|
222
230
|
assert_respond_to(@user, :sid=)
|
223
231
|
end
|
224
|
-
|
232
|
+
|
225
233
|
def test_user_instance_status
|
226
234
|
assert_respond_to(@user, :status)
|
227
235
|
assert_respond_to(@user, :status=)
|
228
236
|
end
|
229
|
-
|
237
|
+
|
230
238
|
def test_user_instance_disabled
|
231
239
|
assert_respond_to(@user, :disabled?)
|
232
240
|
assert_respond_to(@user, :disabled=)
|
233
241
|
end
|
234
|
-
|
242
|
+
|
235
243
|
def test_user_instance_local
|
236
244
|
assert_respond_to(@user, :local?)
|
237
245
|
assert_respond_to(@user, :local=)
|
238
246
|
end
|
239
|
-
|
247
|
+
|
240
248
|
def test_user_instance_lockout
|
241
249
|
assert_respond_to(@user, :lockout?)
|
242
250
|
assert_respond_to(@user, :lockout=)
|
243
251
|
end
|
244
|
-
|
252
|
+
|
245
253
|
def test_user_instance_password_changeable
|
246
254
|
assert_respond_to(@user, :password_changeable?)
|
247
255
|
assert_respond_to(@user, :password_changeable=)
|
248
256
|
end
|
249
|
-
|
257
|
+
|
250
258
|
def test_user_instance_password_expires
|
251
259
|
assert_respond_to(@user, :password_expires?)
|
252
260
|
assert_respond_to(@user, :password_expires=)
|
253
261
|
end
|
254
|
-
|
262
|
+
|
255
263
|
def test_user_instance_password_required
|
256
264
|
assert_respond_to(@user, :password_required?)
|
257
265
|
assert_respond_to(@user, :password_required=)
|
258
266
|
end
|
259
|
-
|
267
|
+
|
260
268
|
def test_user_instance_account_type
|
261
269
|
assert_respond_to(@user, :account_type)
|
262
270
|
assert_respond_to(@user, :account_type=)
|
@@ -266,64 +274,64 @@ class TC_Sys_Admin_Win32 < Test::Unit::TestCase
|
|
266
274
|
assert_respond_to(@user, :uid)
|
267
275
|
assert_respond_to(@user, :uid=)
|
268
276
|
end
|
269
|
-
|
277
|
+
|
270
278
|
def test_user_dir_basic
|
271
279
|
assert_respond_to(@user, :dir)
|
272
|
-
assert_respond_to(@user, :dir=)
|
280
|
+
assert_respond_to(@user, :dir=)
|
273
281
|
end
|
274
|
-
|
282
|
+
|
275
283
|
def test_user_dir
|
276
284
|
assert_nothing_raised{ @user = Admin.get_user(@user_name, :localaccount => true) }
|
277
285
|
assert_kind_of([String, NilClass], @user.dir)
|
278
286
|
end
|
279
|
-
|
287
|
+
|
280
288
|
# Group class
|
281
|
-
|
289
|
+
|
282
290
|
def test_group_instance_caption
|
283
291
|
assert_respond_to(@group, :caption)
|
284
292
|
assert_respond_to(@group, :caption=)
|
285
293
|
end
|
286
|
-
|
294
|
+
|
287
295
|
def test_group_instance_description
|
288
296
|
assert_respond_to(@group, :description)
|
289
297
|
assert_respond_to(@group, :description=)
|
290
298
|
end
|
291
|
-
|
299
|
+
|
292
300
|
def test_group_instance_domain
|
293
301
|
assert_respond_to(@group, :domain)
|
294
302
|
assert_respond_to(@group, :domain=)
|
295
303
|
end
|
296
|
-
|
304
|
+
|
297
305
|
def test_group_instance_install_date
|
298
306
|
assert_respond_to(@group, :install_date)
|
299
307
|
assert_respond_to(@group, :install_date=)
|
300
308
|
end
|
301
|
-
|
309
|
+
|
302
310
|
def test_group_instance_name
|
303
311
|
assert_respond_to(@group, :name)
|
304
312
|
assert_respond_to(@group, :name)
|
305
313
|
end
|
306
|
-
|
314
|
+
|
307
315
|
def test_group_instance_gid
|
308
316
|
assert_respond_to(@group, :gid)
|
309
317
|
assert_respond_to(@group, :gid=)
|
310
318
|
end
|
311
|
-
|
319
|
+
|
312
320
|
def test_group_instance_status
|
313
321
|
assert_respond_to(@group, :status)
|
314
322
|
assert_respond_to(@group, :status=)
|
315
323
|
end
|
316
|
-
|
324
|
+
|
317
325
|
def test_group_instance_sid
|
318
326
|
assert_respond_to(@group, :sid)
|
319
327
|
assert_respond_to(@group, :sid=)
|
320
328
|
end
|
321
|
-
|
329
|
+
|
322
330
|
def test_group_instance_sid_type
|
323
331
|
assert_respond_to(@group, :sid_type)
|
324
332
|
assert_respond_to(@group, :sid_type=)
|
325
333
|
end
|
326
|
-
|
334
|
+
|
327
335
|
def test_group_instance_local
|
328
336
|
assert_respond_to(@group, :local?)
|
329
337
|
assert_respond_to(@group, :local=)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 6
|
10
|
+
version: 1.5.6
|
11
11
|
platform: x86-mingw32
|
12
12
|
authors:
|
13
13
|
- Daniel J. Berger
|
@@ -15,7 +15,8 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-30 00:00:00 -06:00
|
19
|
+
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: test-unit
|
@@ -73,6 +74,7 @@ files:
|
|
73
74
|
- test/test_sys_admin.rb
|
74
75
|
- test/test_sys_admin_unix.rb
|
75
76
|
- test/test_sys_admin_windows.rb
|
77
|
+
has_rdoc: true
|
76
78
|
homepage: http://www.github.com/djberg96/sysutils
|
77
79
|
licenses:
|
78
80
|
- Artistic 2.0
|
@@ -102,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
104
|
requirements: []
|
103
105
|
|
104
106
|
rubyforge_project: sysutils
|
105
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.3.7
|
106
108
|
signing_key:
|
107
109
|
specification_version: 3
|
108
110
|
summary: A unified, cross platform replacement for the "etc" library.
|