sys-admin 1.8.0-universal-mingw32
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +204 -0
- data/Gemfile +2 -0
- data/LICENSE +177 -0
- data/MANIFEST.md +20 -0
- data/README.md +162 -0
- data/Rakefile +44 -0
- data/certs/djberg96_pub.pem +26 -0
- data/doc/sys-admin-unix.txt +162 -0
- data/doc/sys-admin-windows.txt +346 -0
- data/examples/example_groups.rb +27 -0
- data/examples/example_users.rb +41 -0
- data/lib/bsd/sys/admin.rb +262 -0
- data/lib/darwin/sys/admin.rb +244 -0
- data/lib/linux/sys/admin.rb +272 -0
- data/lib/sunos/sys/admin.rb +268 -0
- data/lib/sys/admin/common.rb +134 -0
- data/lib/sys/admin/custom.rb +16 -0
- data/lib/sys/admin.rb +24 -0
- data/lib/sys-admin.rb +1 -0
- data/lib/unix/sys/admin.rb +165 -0
- data/lib/windows/sys/admin.rb +1018 -0
- data/spec/sys_admin_unix_spec.rb +262 -0
- data/spec/sys_admin_windows_spec.rb +350 -0
- data/sys-admin.gemspec +44 -0
- data.tar.gz.sig +0 -0
- metadata +162 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,262 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# sys_admin_unix_rspec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the Unix version of sys-admin. This test should be run
|
5
|
+
# via the 'rake spec' task.
|
6
|
+
###############################################################################
|
7
|
+
require 'rspec'
|
8
|
+
require 'sys/admin'
|
9
|
+
|
10
|
+
RSpec.describe Sys::Admin, :unix do
|
11
|
+
let(:user) { 'nobody' }
|
12
|
+
let(:user_id) { 0 }
|
13
|
+
let(:group) { 'sys' }
|
14
|
+
let(:group_id) { 3 }
|
15
|
+
|
16
|
+
context "singleton methods" do
|
17
|
+
describe "get_login" do
|
18
|
+
example "get_login basic functionality" do
|
19
|
+
expect(described_class).to respond_to(:get_login)
|
20
|
+
expect{ described_class.get_login }.not_to raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
example "get_login returns a string" do
|
24
|
+
expect(described_class.get_login).to be_kind_of(String)
|
25
|
+
expect(described_class.get_login.length).to be > 0
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "get_user" do
|
30
|
+
example "get_user basic functionality" do
|
31
|
+
expect(described_class).to respond_to(:get_user)
|
32
|
+
expect{ described_class.get_user(user) }.not_to raise_error
|
33
|
+
expect{ described_class.get_user(user_id) }.not_to raise_error
|
34
|
+
end
|
35
|
+
|
36
|
+
example "get_user with a string argument works as expected" do
|
37
|
+
expect(described_class.get_user(user)).to be_kind_of(Sys::Admin::User)
|
38
|
+
end
|
39
|
+
|
40
|
+
example "get_user with an integer argument works as expected" do
|
41
|
+
expect(described_class.get_user(user_id)).to be_kind_of(Sys::Admin::User)
|
42
|
+
end
|
43
|
+
|
44
|
+
example "get_user requires one argument only" do
|
45
|
+
expect{ described_class.get_user }.to raise_error(ArgumentError)
|
46
|
+
expect{ described_class.get_user(user, user) }.to raise_error(ArgumentError)
|
47
|
+
end
|
48
|
+
|
49
|
+
example "get_user requires a string or integer argument" do
|
50
|
+
expect{ described_class.get_user([]) }.to raise_error(TypeError)
|
51
|
+
end
|
52
|
+
|
53
|
+
example "get_user raises an Error if the user cannot be found" do
|
54
|
+
expect{ described_class.get_user('foofoofoo') }.to raise_error(Sys::Admin::Error)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "users" do
|
59
|
+
example "users basic functionality" do
|
60
|
+
expect(described_class).to respond_to(:users)
|
61
|
+
expect{ described_class.users }.not_to raise_error
|
62
|
+
end
|
63
|
+
|
64
|
+
example "users returns an array of User objects" do
|
65
|
+
users = described_class.users
|
66
|
+
expect(users).to be_kind_of(Array)
|
67
|
+
expect(users).to all(be_kind_of(Sys::Admin::User))
|
68
|
+
end
|
69
|
+
|
70
|
+
example "users does not accept any arguments" do
|
71
|
+
expect{ described_class.users(user_id) }.to raise_error(ArgumentError)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "get_group" do
|
76
|
+
example "get_group basic functionality" do
|
77
|
+
expect(described_class).to respond_to(:get_group)
|
78
|
+
expect{ described_class.get_group(group) }.not_to raise_error
|
79
|
+
expect{ described_class.get_group(group_id) }.not_to raise_error
|
80
|
+
end
|
81
|
+
|
82
|
+
example "get_group accepts a string argument" do
|
83
|
+
expect(described_class.get_group(group)).to be_kind_of(Sys::Admin::Group)
|
84
|
+
end
|
85
|
+
|
86
|
+
example "get_group accepts an integer argument" do
|
87
|
+
expect(described_class.get_group(group_id)).to be_kind_of(Sys::Admin::Group)
|
88
|
+
end
|
89
|
+
|
90
|
+
example "get_group requires one argument only" do
|
91
|
+
expect{ described_class.get_group }.to raise_error(ArgumentError)
|
92
|
+
expect{ described_class.get_group(group_id, group_id) }.to raise_error(ArgumentError)
|
93
|
+
end
|
94
|
+
|
95
|
+
example "get_group raises a TypeError if an invalid type is passed" do
|
96
|
+
expect{ described_class.get_group([]) }.to raise_error(TypeError)
|
97
|
+
end
|
98
|
+
|
99
|
+
example "get_group raises an Error if the group cannot be found" do
|
100
|
+
expect{ described_class.get_group('foofoofoo') }.to raise_error(Sys::Admin::Error)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "groups" do
|
105
|
+
example "groups basic functionality" do
|
106
|
+
expect(described_class).to respond_to(:groups)
|
107
|
+
expect{ described_class.groups }.not_to raise_error
|
108
|
+
end
|
109
|
+
|
110
|
+
example "groups returns an array of Group objects" do
|
111
|
+
groups = described_class.groups
|
112
|
+
expect(groups).to be_kind_of(Array)
|
113
|
+
expect(groups).to all(be_kind_of(Sys::Admin::Group))
|
114
|
+
end
|
115
|
+
|
116
|
+
example "groups method does not accept any arguments" do
|
117
|
+
expect{ described_class.groups(group_id) }.to raise_error(ArgumentError)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context "instance methods" do
|
123
|
+
describe "User instance methods" do
|
124
|
+
example "user.name behaves as expected" do
|
125
|
+
user = described_class.get_user(user_id)
|
126
|
+
expect(user).to respond_to(:name)
|
127
|
+
expect(user.name).to be_kind_of(String)
|
128
|
+
end
|
129
|
+
|
130
|
+
example "user.passwd behaves as expected" do
|
131
|
+
user = described_class.get_user(user_id)
|
132
|
+
expect(user).to respond_to(:passwd)
|
133
|
+
expect(user.passwd).to be_kind_of(String)
|
134
|
+
end
|
135
|
+
|
136
|
+
example "user.uid behaves as expected" do
|
137
|
+
user = described_class.get_user(user_id)
|
138
|
+
expect(user).to respond_to(:uid)
|
139
|
+
expect(user.uid).to be_kind_of(Integer)
|
140
|
+
end
|
141
|
+
|
142
|
+
example "user.gid behaves as expected" do
|
143
|
+
user = described_class.get_user(user_id)
|
144
|
+
expect(user).to respond_to(:gid)
|
145
|
+
expect(user.gid).to be_kind_of(Integer)
|
146
|
+
end
|
147
|
+
|
148
|
+
example "user.dir behaves as expected" do
|
149
|
+
user = described_class.get_user(user_id)
|
150
|
+
expect(user).to respond_to(:dir)
|
151
|
+
expect(user.dir).to be_kind_of(String)
|
152
|
+
end
|
153
|
+
|
154
|
+
example "user.shell behaves as expected" do
|
155
|
+
user = described_class.get_user(user_id)
|
156
|
+
expect(user).to respond_to(:shell)
|
157
|
+
expect(user.shell).to be_kind_of(String)
|
158
|
+
end
|
159
|
+
|
160
|
+
example "user.gecos behaves as expected" do
|
161
|
+
user = described_class.get_user(user_id)
|
162
|
+
expect(user).to respond_to(:gecos)
|
163
|
+
expect(user.gecos).to be_kind_of(String).or be_nil
|
164
|
+
end
|
165
|
+
|
166
|
+
example "user.quota behaves as expected" do
|
167
|
+
user = described_class.get_user(user_id)
|
168
|
+
expect(user).to respond_to(:quota)
|
169
|
+
expect(user.quota).to be_kind_of(Integer).or be_nil
|
170
|
+
end
|
171
|
+
|
172
|
+
example "user.age behaves as expected" do
|
173
|
+
user = described_class.get_user(user_id)
|
174
|
+
expect(user).to respond_to(:age)
|
175
|
+
expect(user.age).to be_kind_of(Integer).or be_nil
|
176
|
+
end
|
177
|
+
|
178
|
+
example "user.access behaves as expected" do
|
179
|
+
user = described_class.get_user(user_id)
|
180
|
+
expect(user).to respond_to(:access_class)
|
181
|
+
expect(user.access_class).to be_kind_of(String).or be_nil
|
182
|
+
end
|
183
|
+
|
184
|
+
example "user.comment behaves as expected" do
|
185
|
+
user = described_class.get_user(user_id)
|
186
|
+
expect(user).to respond_to(:comment)
|
187
|
+
expect(user.comment).to be_kind_of(String).or be_nil
|
188
|
+
end
|
189
|
+
|
190
|
+
example "user.expire behaves as expected" do
|
191
|
+
user = described_class.get_user(user_id)
|
192
|
+
expect(user).to respond_to(:expire)
|
193
|
+
expect(user.expire).to be_kind_of(Time).or be_nil
|
194
|
+
end
|
195
|
+
|
196
|
+
example "user.change behaves as expected" do
|
197
|
+
user = described_class.get_user(user_id)
|
198
|
+
expect(user).to respond_to(:change)
|
199
|
+
expect(user.change).to be_kind_of(Time).or be_nil
|
200
|
+
end
|
201
|
+
|
202
|
+
example "user.login_time behaves as expected" do
|
203
|
+
user = described_class.get_user(user_id)
|
204
|
+
expect(user).to respond_to(:login_time)
|
205
|
+
expect(user.login_time).to be_kind_of(Time).or be_nil
|
206
|
+
end
|
207
|
+
|
208
|
+
example "user.login_device behaves as expected" do
|
209
|
+
user = described_class.get_user(user_id)
|
210
|
+
expect(user).to respond_to(:login_device)
|
211
|
+
expect(user.login_device).to be_kind_of(String).or be_nil
|
212
|
+
end
|
213
|
+
|
214
|
+
example "user.login_host behaves as expected" do
|
215
|
+
user = described_class.get_user(user_id)
|
216
|
+
expect(user).to respond_to(:login_host)
|
217
|
+
expect(user.login_host).to be_kind_of(String).or be_nil
|
218
|
+
end
|
219
|
+
|
220
|
+
example "user.groups behaves as expected" do
|
221
|
+
user = described_class.get_user(user_id)
|
222
|
+
expect(user).to respond_to(:groups)
|
223
|
+
expect(user.groups).to be_kind_of(Array)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe "Group instance methods" do
|
228
|
+
example "group.name behaves as expected" do
|
229
|
+
group = described_class.get_group(group_id)
|
230
|
+
expect(group).to respond_to(:name)
|
231
|
+
expect(group.name).to be_kind_of(String)
|
232
|
+
end
|
233
|
+
|
234
|
+
example "group.gid behaves as expected" do
|
235
|
+
group = described_class.get_group(group_id)
|
236
|
+
expect(group).to respond_to(:gid)
|
237
|
+
expect(group.gid).to be_kind_of(Integer)
|
238
|
+
end
|
239
|
+
|
240
|
+
example "group.members behaves as expected" do
|
241
|
+
group = described_class.get_group(group_id)
|
242
|
+
expect(group).to respond_to(:members)
|
243
|
+
expect(group.members).to be_kind_of(Array)
|
244
|
+
end
|
245
|
+
|
246
|
+
example "group.passwd behaves as expected" do
|
247
|
+
group = described_class.get_group(group_id)
|
248
|
+
expect(group).to respond_to(:passwd)
|
249
|
+
expect(group.passwd).to be_kind_of(String)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
context "ffi functions" do
|
255
|
+
example "ffi functions are private" do
|
256
|
+
methods = described_class.methods(false).map(&:to_s)
|
257
|
+
expect(methods).not_to include('getlogin')
|
258
|
+
expect(methods).not_to include('getlogin_r')
|
259
|
+
expect(methods).not_to include('strerror')
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
@@ -0,0 +1,350 @@
|
|
1
|
+
###############################################################################
|
2
|
+
# sys_admin_windows_spec.rb
|
3
|
+
#
|
4
|
+
# Test suite for the MS Windows version of sys-admin. Note that some of the
|
5
|
+
# are ordered. That way I can add test users before configuring or deleting
|
6
|
+
# them.
|
7
|
+
#
|
8
|
+
# It is assumed that these specs will be run via the 'rake spec' task.
|
9
|
+
###############################################################################
|
10
|
+
require 'rspec'
|
11
|
+
require 'sys/admin'
|
12
|
+
require 'win32/security'
|
13
|
+
require 'socket'
|
14
|
+
|
15
|
+
RSpec.describe Sys::Admin, :windows do
|
16
|
+
let(:host) { Socket.gethostname }
|
17
|
+
let(:elevated) { Win32::Security.elevated_security? }
|
18
|
+
|
19
|
+
before do
|
20
|
+
@user = Sys::Admin::User.new
|
21
|
+
@user_name = 'Guest'
|
22
|
+
@user_id = 501 # best guess, may fail
|
23
|
+
@group = Sys::Admin::Group.new
|
24
|
+
@group_name = 'Guests'
|
25
|
+
@group_id = 546 # best guess, may fail
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "add, configure and delete user", :order => :defined do
|
29
|
+
before(:all) do
|
30
|
+
@local_user = "foo"
|
31
|
+
end
|
32
|
+
|
33
|
+
example "add user" do
|
34
|
+
skip "requires elevated privileges" unless elevated
|
35
|
+
expect(described_class).to respond_to(:add_user)
|
36
|
+
expect{ described_class.add_user(:name => @local_user, :password => 'a1b2c3D4') }.not_to raise_error
|
37
|
+
expect{ described_class.get_user(@local_user) }.not_to raise_error
|
38
|
+
end
|
39
|
+
|
40
|
+
example "configure user" do
|
41
|
+
skip "requires elevated privileges" unless elevated
|
42
|
+
expect(described_class).to respond_to(:configure_user)
|
43
|
+
expect{
|
44
|
+
described_class.configure_user(
|
45
|
+
:name => @local_user,
|
46
|
+
:description => 'delete me',
|
47
|
+
:fullname => 'fubar',
|
48
|
+
:password => 'd1c2b3A4'
|
49
|
+
)
|
50
|
+
}.not_to raise_error
|
51
|
+
expect(described_class.get_user(@local_user).description).to eq('delete me')
|
52
|
+
end
|
53
|
+
|
54
|
+
example "delete user" do
|
55
|
+
skip "requires elevated privileges" unless elevated
|
56
|
+
expect(described_class).to respond_to(:delete_user)
|
57
|
+
expect{ described_class.delete_user(@local_user) }.not_to raise_error
|
58
|
+
expect{ described_class.get_user(@local_user) }.to raise_error(Sys::Admin::Error)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "add, configure and delete group", :order => :defined do
|
63
|
+
before(:all) do
|
64
|
+
@local_user = "foo"
|
65
|
+
@local_group = "bar"
|
66
|
+
described_class.add_user(:name => @local_user)
|
67
|
+
end
|
68
|
+
|
69
|
+
after(:all) do
|
70
|
+
described_class.delete_user(@local_user)
|
71
|
+
end
|
72
|
+
|
73
|
+
example "add group" do
|
74
|
+
skip "requires elevated privileges" unless elevated
|
75
|
+
expect(described_class).to respond_to(:add_group)
|
76
|
+
expect{ described_class.add_group(:name => @local_group) }.not_to raise_error
|
77
|
+
end
|
78
|
+
|
79
|
+
example "configure group" do
|
80
|
+
skip "requires elevated privileges" unless elevated
|
81
|
+
expect(described_class).to respond_to(:configure_group)
|
82
|
+
expect{ described_class.configure_group(:name => @local_group, :description => 'delete me') }.not_to raise_error
|
83
|
+
end
|
84
|
+
|
85
|
+
example "add group member" do
|
86
|
+
skip "requires elevated privileges" unless elevated
|
87
|
+
expect(described_class).to respond_to(:add_group_member)
|
88
|
+
expect{ described_class.add_group_member(@local_user, @local_group) }.not_to raise_error
|
89
|
+
expect(described_class.get_group(@local_group, :localaccount => true).members).to include(@local_user)
|
90
|
+
end
|
91
|
+
|
92
|
+
example "remove group member" do
|
93
|
+
skip "requires elevated privileges" unless elevated
|
94
|
+
expect(described_class).to respond_to(:remove_group_member)
|
95
|
+
expect{ described_class.remove_group_member(@local_user, @local_group) }.not_to raise_error
|
96
|
+
end
|
97
|
+
|
98
|
+
example "delete group" do
|
99
|
+
skip "requires elevated privileges" unless elevated
|
100
|
+
expect(described_class).to respond_to(:delete_group)
|
101
|
+
expect{ described_class.delete_group(@local_group) }.not_to raise_error
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context "singleton methods" do
|
106
|
+
describe "get_login" do
|
107
|
+
example "get_login basic functionality" do
|
108
|
+
expect(described_class).to respond_to(:get_login)
|
109
|
+
expect{ described_class.get_login }.not_to raise_error
|
110
|
+
end
|
111
|
+
|
112
|
+
example "get_login returns a string" do
|
113
|
+
expect( described_class.get_login).to be_kind_of(String)
|
114
|
+
expect(described_class.get_login.size).to be > 0
|
115
|
+
end
|
116
|
+
|
117
|
+
example "get_login does not accept any arguments" do
|
118
|
+
expect{ described_class.get_login('foo') }.to raise_error(ArgumentError)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "get_user" do
|
123
|
+
example "get_user basic functionality" do
|
124
|
+
expect(described_class).to respond_to(:get_user)
|
125
|
+
end
|
126
|
+
|
127
|
+
example "get_user with string argument works as expected" do
|
128
|
+
expect{ described_class.get_user(@user_name, :localaccount => true) }.not_to raise_error
|
129
|
+
expect( described_class.get_user(@user_name, :localaccount => true)).to be_kind_of(Sys::Admin::User)
|
130
|
+
end
|
131
|
+
|
132
|
+
example "get user with integer argument works as expected" do
|
133
|
+
expect{ described_class.get_user(@user_id, :localaccount => true) }.not_to raise_error
|
134
|
+
expect( described_class.get_user(@user_id, :localaccount => true)).to be_kind_of(Sys::Admin::User)
|
135
|
+
end
|
136
|
+
|
137
|
+
example "get_user method by string accepts a hash of options" do
|
138
|
+
options = {:host => host, :localaccount => true}
|
139
|
+
expect{ described_class.get_user(@user_name, options) }.not_to raise_error
|
140
|
+
expect( described_class.get_user(@user_name, options)).to be_kind_of(Sys::Admin::User)
|
141
|
+
end
|
142
|
+
|
143
|
+
example "get_user method by uid accepts a hash of options" do
|
144
|
+
options = {:host => host, :localaccount => true}
|
145
|
+
expect{ described_class.get_user(@user_id, options) }.not_to raise_error
|
146
|
+
expect( described_class.get_user(@user_id, options)).to be_kind_of(Sys::Admin::User)
|
147
|
+
end
|
148
|
+
|
149
|
+
example "get_user method requires an argument" do
|
150
|
+
expect{ described_class.get_user }.to raise_error(ArgumentError)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
describe "users" do
|
155
|
+
example "users method basic functionality" do
|
156
|
+
expect(described_class).to respond_to(:users)
|
157
|
+
expect{ described_class.users(:localaccount => true) }.not_to raise_error
|
158
|
+
end
|
159
|
+
|
160
|
+
example "users method returns an array of User objects" do
|
161
|
+
users = described_class.users(:localaccount => true)
|
162
|
+
expect(users).to be_kind_of(Array)
|
163
|
+
expect(users).to all(be_kind_of(Sys::Admin::User))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe "get_group" do
|
168
|
+
example "get_group basic functionality" do
|
169
|
+
expect(described_class).to respond_to(:get_group)
|
170
|
+
end
|
171
|
+
|
172
|
+
example "get_group method returns expected results with a string argument" do
|
173
|
+
expect{ described_class.get_group(@group_name, :localaccount => true) }.not_to raise_error
|
174
|
+
expect(described_class.get_group(@group_name, :localaccount => true)).to be_kind_of(Sys::Admin::Group)
|
175
|
+
end
|
176
|
+
|
177
|
+
example "get_group method returns expected results with an integer argument" do
|
178
|
+
expect{ described_class.get_group(@group_id, :localaccount => true) }.not_to raise_error
|
179
|
+
expect(described_class.get_group(@group_id, :localaccount => true)).to be_kind_of(Sys::Admin::Group)
|
180
|
+
end
|
181
|
+
|
182
|
+
example "get_group method accepts a hash of options" do
|
183
|
+
options = {:host => host, :localaccount => true}
|
184
|
+
expect{ described_class.get_group(@group_name, options) }.not_to raise_error
|
185
|
+
expect(described_class.get_group(@group_name, options)).to be_kind_of(Sys::Admin::Group)
|
186
|
+
end
|
187
|
+
|
188
|
+
example "get_group method requires an argument" do
|
189
|
+
expect{ described_class.get_group }.to raise_error(ArgumentError)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
describe "groups" do
|
194
|
+
example "groups method basic functionality" do
|
195
|
+
expect(described_class).to respond_to(:groups)
|
196
|
+
expect{ described_class.groups(:localaccount => true) }.not_to raise_error
|
197
|
+
end
|
198
|
+
|
199
|
+
example "groups method returns an array of Group objects" do
|
200
|
+
groups = described_class.groups(:localaccount => true)
|
201
|
+
expect(groups).to be_kind_of(Array)
|
202
|
+
expect(groups).to all(be_kind_of(Sys::Admin::Group))
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "User class" do
|
208
|
+
example "caption accessor for User class" do
|
209
|
+
expect(@user).to respond_to(:caption)
|
210
|
+
expect(@user).to respond_to(:caption=)
|
211
|
+
end
|
212
|
+
|
213
|
+
example "description accessor for User class" do
|
214
|
+
expect(@user).to respond_to(:description)
|
215
|
+
expect(@user).to respond_to(:description=)
|
216
|
+
end
|
217
|
+
|
218
|
+
example "domain accessor for User class" do
|
219
|
+
expect(@user).to respond_to(:domain)
|
220
|
+
expect(@user).to respond_to(:domain=)
|
221
|
+
end
|
222
|
+
|
223
|
+
example "password accessor for User class" do
|
224
|
+
expect(@user).to respond_to(:password)
|
225
|
+
expect(@user).to respond_to(:password=)
|
226
|
+
end
|
227
|
+
|
228
|
+
example "full_name accessor for User class" do
|
229
|
+
expect(@user).to respond_to(:full_name)
|
230
|
+
expect(@user).to respond_to(:full_name=)
|
231
|
+
end
|
232
|
+
|
233
|
+
example "name accessor for User class" do
|
234
|
+
expect(@user).to respond_to(:name)
|
235
|
+
expect(@user).to respond_to(:name=)
|
236
|
+
end
|
237
|
+
|
238
|
+
example "sid accessor for User class" do
|
239
|
+
expect(@user).to respond_to(:sid)
|
240
|
+
expect(@user).to respond_to(:sid=)
|
241
|
+
end
|
242
|
+
|
243
|
+
example "status accessor for User class" do
|
244
|
+
expect(@user).to respond_to(:status)
|
245
|
+
expect(@user).to respond_to(:status=)
|
246
|
+
end
|
247
|
+
|
248
|
+
example "disabled accessor for User class" do
|
249
|
+
expect(@user).to respond_to(:disabled?)
|
250
|
+
expect(@user).to respond_to(:disabled=)
|
251
|
+
end
|
252
|
+
|
253
|
+
example "local accessor for User class" do
|
254
|
+
expect(@user).to respond_to(:local?)
|
255
|
+
expect(@user).to respond_to(:local=)
|
256
|
+
end
|
257
|
+
|
258
|
+
example "lockout accessor for User class" do
|
259
|
+
expect(@user).to respond_to(:lockout?)
|
260
|
+
expect(@user).to respond_to(:lockout=)
|
261
|
+
end
|
262
|
+
|
263
|
+
example "password_changeable accessor for User class" do
|
264
|
+
expect(@user).to respond_to(:password_changeable?)
|
265
|
+
expect(@user).to respond_to(:password_changeable=)
|
266
|
+
end
|
267
|
+
|
268
|
+
example "password_expires accessor for User class" do
|
269
|
+
expect(@user).to respond_to(:password_expires?)
|
270
|
+
expect(@user).to respond_to(:password_expires=)
|
271
|
+
end
|
272
|
+
|
273
|
+
example "password_required accessor for User class" do
|
274
|
+
expect(@user).to respond_to(:password_required?)
|
275
|
+
expect(@user).to respond_to(:password_required=)
|
276
|
+
end
|
277
|
+
|
278
|
+
example "account_type accessor for User class" do
|
279
|
+
expect(@user).to respond_to(:account_type)
|
280
|
+
expect(@user).to respond_to(:account_type=)
|
281
|
+
end
|
282
|
+
|
283
|
+
example "uid accessor for User class" do
|
284
|
+
expect(@user).to respond_to(:uid)
|
285
|
+
expect(@user).to respond_to(:uid=)
|
286
|
+
end
|
287
|
+
|
288
|
+
example "dir accessor for User class" do
|
289
|
+
expect(@user).to respond_to(:dir)
|
290
|
+
expect(@user).to respond_to(:dir=)
|
291
|
+
end
|
292
|
+
|
293
|
+
example "dir method returns either a string or nil" do
|
294
|
+
expect{ @user = described_class.get_user(@user_name, :localaccount => true) }.not_to raise_error
|
295
|
+
expect(@user.dir).to be_kind_of(String).or be_kind_of(NilClass)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
context "Group class" do
|
300
|
+
example "caption accessor for Group class" do
|
301
|
+
expect(@group).to respond_to(:caption)
|
302
|
+
expect(@group).to respond_to(:caption=)
|
303
|
+
end
|
304
|
+
|
305
|
+
example "description accessor for Group class" do
|
306
|
+
expect(@group).to respond_to(:description)
|
307
|
+
expect(@group).to respond_to(:description=)
|
308
|
+
end
|
309
|
+
|
310
|
+
example "domain accessor for Group class" do
|
311
|
+
expect(@group).to respond_to(:domain)
|
312
|
+
expect(@group).to respond_to(:domain=)
|
313
|
+
end
|
314
|
+
|
315
|
+
example "install_date accessor for Group class" do
|
316
|
+
expect(@group).to respond_to(:install_date)
|
317
|
+
expect(@group).to respond_to(:install_date=)
|
318
|
+
end
|
319
|
+
|
320
|
+
example "name accessor for Group class" do
|
321
|
+
expect(@group).to respond_to(:name)
|
322
|
+
expect(@group).to respond_to(:name)
|
323
|
+
end
|
324
|
+
|
325
|
+
example "gid accessor for Group class" do
|
326
|
+
expect(@group).to respond_to(:gid)
|
327
|
+
expect(@group).to respond_to(:gid=)
|
328
|
+
end
|
329
|
+
|
330
|
+
example "status accessor for Group class" do
|
331
|
+
expect(@group).to respond_to(:status)
|
332
|
+
expect(@group).to respond_to(:status=)
|
333
|
+
end
|
334
|
+
|
335
|
+
example "sid accessor for Group class" do
|
336
|
+
expect(@group).to respond_to(:sid)
|
337
|
+
expect(@group).to respond_to(:sid=)
|
338
|
+
end
|
339
|
+
|
340
|
+
example "sid_type accessor for Group class" do
|
341
|
+
expect(@group).to respond_to(:sid_type)
|
342
|
+
expect(@group).to respond_to(:sid_type=)
|
343
|
+
end
|
344
|
+
|
345
|
+
example "local accessor for Group class" do
|
346
|
+
expect(@group).to respond_to(:local?)
|
347
|
+
expect(@group).to respond_to(:local=)
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|