zabbixapi 0.5.0b2 → 0.5.0b3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,98 +1,22 @@
1
1
  class ZabbixApi
2
- class Usergroups
2
+ class Usergroups < Basic
3
3
 
4
- def initialize(options = {})
5
- @client = Client.new(options)
6
- @options = options
4
+ def api_method_name
5
+ "usergroup"
7
6
  end
8
7
 
9
- # Create UserGroup
10
- #
11
- # * *Args* :
12
- # - +data+ -> Hash with :name => "UserGroup"
13
- # * *Returns* :
14
- # - Nil or Integer
15
- def create(data)
16
- result = @client.api_request(:method => "usergroup.create", :params => data)
17
- result ? result['usrgrpids'][0].to_i : nil
18
- end
19
-
20
- # Add UserGroup
21
- # Synonym create
22
- def add(data)
23
- create(data)
8
+ def api_identify
9
+ "name"
24
10
  end
25
11
 
26
- # Delete UserGroup
27
- #
28
- # * *Args* :
29
- # - +data+ -> Array with usrgrpids
30
- # * *Returns* :
31
- # - Nil or Integer
32
- def delete(data)
33
- result = @client.api_request(:method => "usergroup.delete", :params => data)
34
- result ? result['usrgrpids'][0].to_i : nil
12
+ def api_key
13
+ "usrgrpid"
35
14
  end
36
15
 
37
- # Destroy UserGroup
38
- # Synonym delete
39
- def destroy(data)
40
- delete(data)
41
- end
42
-
43
- # Get UserGroup info
44
- #
45
- # * *Args* :
46
- # - +data+ -> Hash with :name => "UserGroup"
47
- # * *Returns* :
48
- # - Nil or Integer
49
16
  def get_full_data(data)
50
- @client.api_request(
51
- :method => "usergroup.get",
52
- :params => {
53
- :filter => [data[:name]],
54
- :output => "extend"
55
- }
56
- )
57
- end
58
-
59
- def get(data)
60
- get_full_data(data)
61
- end
62
-
63
- # Return usrgrpid
64
- #
65
- # * *Args* :
66
- # - +data+ -> Hash with :name => "UserGroup"
67
- # * *Returns* :
68
- # - Nil or Integer
69
- def get_id(data)
70
- result = get_full_data(data)
71
- usrgrpid = nil
72
- result.each { |usr| usrgrpid = usr['usrgrpid'].to_i if usr['name'] == data[:name] }
73
- usrgrpid
74
- end
75
-
76
- # Return usrgrpid
77
- #
78
- # * *Args* :
79
- # - +data+ -> Hash with :name => "UserGroup"
80
- # * *Returns* :
81
- # - Integer
82
- def get_or_create(data)
83
- usrgrpid = get_id(data)
84
- if usrgrpid.nil?
85
- usrgrpid = create(data)
86
- end
87
- usrgrpid
17
+ get_full_data_filter_array(data)
88
18
  end
89
19
 
90
- # Set permission for usrgrp on some hostgroup
91
- #
92
- # * *Args* :
93
- # - +data+ -> Hash with :usrgrpids => id, :hostgroupids => [], :permission => 2,3 (read and read write)
94
- # * *Returns* :
95
- # - Integer
96
20
  def set_perms(data)
97
21
  permission = data[:permission] || 2
98
22
  result = @client.api_request(
@@ -105,12 +29,6 @@ class ZabbixApi
105
29
  result ? result['usrgrpids'][0].to_i : nil
106
30
  end
107
31
 
108
- # Update usergroup, add user
109
- #
110
- # * *Args* :
111
- # - +data+ -> Hash with :usrgrpids => id, :userids => []
112
- # * *Returns* :
113
- # - Integer
114
32
  def add_user(data)
115
33
  result = @client.api_request(
116
34
  :method => "usergroup.massAdd",
@@ -1,44 +1,20 @@
1
1
  class ZabbixApi
2
- class Users
2
+ class Users < Basic
3
3
 
4
- def initialize(options = {})
5
- @client = Client.new(options)
6
- @options = options
4
+ def api_method_name
5
+ "user"
7
6
  end
8
7
 
9
- def create(data)
10
- result = @client.api_request(:method => "user.create", :params => data)
11
- result ? result['userids'][0].to_i : nil
12
- end
13
-
14
- def add(data)
15
- create(data)
8
+ def api_identify
9
+ "name"
16
10
  end
17
11
 
18
12
  def delete(data)
19
- result = @client.api_request(:method => "user.delete", :params => [:userid => data])
20
- result ? result['userids'][0].to_i : nil
13
+ delete_array_sym(data)
21
14
  end
22
15
 
23
16
  def get_full_data(data)
24
- @client.api_request(
25
- :method => "user.get",
26
- :params => {
27
- :filter => {
28
- :name => data[:name]
29
- },
30
- :output => "extend"
31
- }
32
- )
33
- end
34
-
35
- def get(data)
36
- get_full_data(data)
37
- end
38
-
39
- def create_or_update(data)
40
- userid = get_id(:name => data[:name])
41
- userid ? update(data.merge(:userid => userid)) : create(data)
17
+ get_full_data_filter(data)
42
18
  end
43
19
 
44
20
  def add_medias(data)
@@ -52,17 +28,5 @@ class ZabbixApi
52
28
  result ? result['userids'][0].to_i : nil
53
29
  end
54
30
 
55
- def get_id(data)
56
- result = get_full_data(data)
57
- userid = nil
58
- result.each { |usr| userid = usr['userid'].to_i if usr['name'] == data[:name] }
59
- userid
60
- end
61
-
62
- def update(data)
63
- result = @client.api_request(:method => "user.update", :params => data)
64
- result ? result['userids'][0].to_i : nil
65
- end
66
-
67
31
  end
68
32
  end
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.5.0b2"
2
+ VERSION = "0.5.0b3"
3
3
  end
data/spec/localhost.rb CHANGED
@@ -36,11 +36,12 @@ describe ZabbixApi, "test_api" do
36
36
  end
37
37
 
38
38
  it "HOSTGROUP: Create" do
39
- zbx.hostgroups.create(:name => hostgroup).should be_kind_of(Integer)
39
+ $hostgroup_id_real = zbx.hostgroups.create(:name => hostgroup)
40
+ $hostgroup_id_real.should be_kind_of(Integer)
40
41
  end
41
42
 
42
43
  it "HOSTGROUP: Find" do
43
- zbx.hostgroups.get_id(:name => hostgroup).should be_kind_of(Integer)
44
+ zbx.hostgroups.get_id(:name => hostgroup).should equal $hostgroup_id_real
44
45
  end
45
46
 
46
47
  it "HOSTGROUP: Find unknown" do
@@ -48,59 +49,61 @@ describe ZabbixApi, "test_api" do
48
49
  end
49
50
 
50
51
  it "HOSTGROUP: Create or get" do
51
- zbx.hostgroups.get_or_create(:name => hostgroup).should be_kind_of(Integer)
52
+ zbx.hostgroups.get_or_create(:name => hostgroup).should equal $hostgroup_id_real
52
53
  end
53
54
 
54
55
  it "HOSTGROUP: Get all" do
55
- zbx.hostgroups.all.should be_kind_of(Hash)
56
+ zbx.hostgroups.all.should include(hostgroup => $hostgroup_id_real.to_s)
56
57
  end
57
58
 
58
59
  it "TEMPLATE: Create" do
59
- zbx.templates.create(
60
+ $template_id_real = zbx.templates.create(
60
61
  :host => template,
61
62
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
62
- ).should be_kind_of(Integer)
63
+ )
64
+ $template_id_real.should be_kind_of(Integer)
63
65
  end
64
66
 
65
67
  it "TEMPLATE: Get get or create" do
66
68
  zbx.templates.get_or_create(
67
69
  :host => template,
68
70
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
69
- ).should be_kind_of(Integer)
70
- end
71
-
72
- it "TEMPLATE: Check full data" do
73
- zbx.templates.get_full_data(:host => template)[0]['host'].should be_kind_of(String)
71
+ ).should equal $template_id_real
74
72
  end
75
73
 
76
74
  it "TEMPLATE: Find" do
77
- zbx.templates.get_id(:host => template).should be_kind_of(Integer)
75
+ zbx.templates.get_id(:host => template).should equal $template_id_real
78
76
  end
79
77
 
80
78
  it "TEMPLATE: Find unknown" do
81
79
  zbx.templates.get_id(:host => "#{template}_____").should be_kind_of(NilClass)
82
80
  end
83
81
 
82
+ it "TEMPLATE: Get all" do
83
+ zbx.templates.all.should include(template => $template_id_real.to_s)
84
+ end
85
+
84
86
  it "APPLICATION: Create" do
85
- zbx.applications.create(
87
+ $application_id_real = zbx.applications.create(
86
88
  :name => application,
87
89
  :hostid => zbx.templates.get_id(:host => template)
88
90
  )
91
+ $application_id_real.should be_kind_of(Integer)
92
+ end
93
+
94
+ it "APPLICATION: Get all" do
95
+ zbx.applications.all.should include(application => $application_id_real.to_s)
89
96
  end
90
97
 
91
98
  it "APPLICATION: Get or create" do
92
99
  zbx.applications.get_or_create(
93
100
  :name => application,
94
101
  :hostid => zbx.templates.get_id(:host => template)
95
- )
96
- end
97
-
98
- it "APPLICATION: Full info check" do
99
- zbx.applications.get_full_data(:name => application)[0]['applicationid'].should be_kind_of(String)
102
+ ).should equal $application_id_real
100
103
  end
101
104
 
102
105
  it "APPLICATION: Find" do
103
- zbx.applications.get_id(:name => application).should be_kind_of(Integer)
106
+ zbx.applications.get_id(:name => application).should equal $application_id_real
104
107
  end
105
108
 
106
109
  it "APPLICATION: Find unknown" do
@@ -108,27 +111,28 @@ describe ZabbixApi, "test_api" do
108
111
  end
109
112
 
110
113
  it "ITEM: Create" do
111
- zbx.items.create(
114
+ $item_id_real = zbx.items.create(
112
115
  :description => item,
113
116
  :key_ => "proc.num[aaa]",
114
117
  :hostid => zbx.templates.get_id(:host => template),
115
118
  :applications => [zbx.applications.get_id(:name => application)]
116
- ).should be_kind_of(Integer)
119
+ )
120
+ $item_id_real.should be_kind_of(Integer)
117
121
  end
118
122
 
119
- it "ITEM: Full info check" do
120
- zbx.items.get_full_data(:description => item)[0]['itemid'].should be_kind_of(String)
123
+ it "ITEM: Find" do
124
+ zbx.items.get_id(:description => item).should equal $item_id_real
121
125
  end
122
126
 
123
- it "ITEM: Find" do
124
- zbx.items.get_id(:description => item).should be_kind_of(Integer)
127
+ it "ITEM: Get all" do
128
+ zbx.items.all.should include(item => $item_id_real.to_s)
125
129
  end
126
130
 
127
131
  it "ITEM: Update" do
128
132
  zbx.items.update(
129
133
  :itemid => zbx.items.get_id(:description => item),
130
134
  :status => 0
131
- ).should be_kind_of(Integer)
135
+ ).should equal $item_id_real
132
136
  end
133
137
 
134
138
  it "ITEM: Create or update" do
@@ -138,19 +142,20 @@ describe ZabbixApi, "test_api" do
138
142
  :type => 6,
139
143
  :hostid => zbx.templates.get_id(:host => template),
140
144
  :applications => [zbx.applications.get_id(:name => application)]
141
- ).should be_kind_of(Integer)
145
+ ).should equal $item_id_real
142
146
  end
143
147
 
144
148
  it "ITEM: Get unknown" do
145
- zbx.items.get_id(:description => "#{item}_____")
149
+ zbx.items.get_id(:description => "#{item}_____").should be_kind_of(NilClass)
146
150
  end
147
151
 
148
152
  it "HOST: Create" do
149
- zbx.hosts.create(
153
+ $host_id_real = zbx.hosts.create(
150
154
  :host => host,
151
155
  :ip => "10.20.48.88",
152
156
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
153
- ).should be_kind_of(Integer)
157
+ )
158
+ $host_id_real.should be_kind_of(Integer)
154
159
  end
155
160
 
156
161
  it "HOST: Update or create" do
@@ -158,7 +163,7 @@ describe ZabbixApi, "test_api" do
158
163
  :host => host,
159
164
  :ip => "10.20.48.89",
160
165
  :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
161
- ).should be_kind_of(Integer)
166
+ ).should equal $host_id_real
162
167
  end
163
168
 
164
169
  it "HOST: Find unknown" do
@@ -166,20 +171,18 @@ describe ZabbixApi, "test_api" do
166
171
  end
167
172
 
168
173
  it "HOST: Find" do
169
- zbx.hosts.get_id(:host => host).should be_kind_of(Integer)
174
+ zbx.hosts.get_id(:host => host).should equal $host_id_real
170
175
  end
171
176
 
172
177
  it "HOST: Update" do
173
178
  zbx.hosts.update(
174
179
  :hostid => zbx.hosts.get_id(:host => host),
175
180
  :status => 0
176
- )
181
+ ).should equal $host_id_real
177
182
  end
178
183
 
179
- it "TEMPLATE: Get all templates linked with host" do
180
- zbx.templates.get_ids_by_host(
181
- :hostids => [zbx.hosts.get_id(:host => host)]
182
- ).should be_kind_of(Array)
184
+ it "HOST: Get all" do
185
+ zbx.hosts.all.should include(host => $host_id_real.to_s)
183
186
  end
184
187
 
185
188
  it "TEMPLATE: Linked hosts with templates" do
@@ -196,12 +199,18 @@ describe ZabbixApi, "test_api" do
196
199
  ).should be_kind_of(TrueClass)
197
200
  end
198
201
 
202
+ it "TEMPLATE: Get all templates linked with host" do
203
+ zbx.templates.get_ids_by_host(
204
+ :hostids => [zbx.hosts.get_id(:host => host)]
205
+ ).should include($template_id_real.to_s)
206
+ end
207
+
199
208
  it "TEMPLATE: Get all" do
200
- zbx.templates.all.should be_kind_of(Hash)
209
+ zbx.templates.all.should include(template => $template_id_real.to_s)
201
210
  end
202
211
 
203
212
  it "TRIGGER: Create" do
204
- zbx.triggers.create(
213
+ $trigger_id_real = zbx.triggers.create(
205
214
  :description => trigger,
206
215
  :expression => "{#{template}:proc.num[aaa].last(0)}<1",
207
216
  :comments => "Bla-bla is faulty (disaster)",
@@ -209,13 +218,22 @@ describe ZabbixApi, "test_api" do
209
218
  :status => 0,
210
219
  :templateid => 0,
211
220
  :type => 0
212
- ).should be_kind_of(Integer)
221
+ )
222
+ $trigger_id_real.should be_kind_of(Integer)
213
223
  end
214
224
 
215
225
  it "TRIGGER: Find" do
216
226
  zbx.triggers.get_id(:description => trigger).should be_kind_of(Integer)
217
227
  end
218
228
 
229
+ it "TRIGGER: Find unknown" do
230
+ zbx.triggers.get_id(:description => "#{trigger}____").should be_kind_of(NilClass)
231
+ end
232
+
233
+ it "TRIGGER: Get all" do
234
+ zbx.triggers.all.should be_kind_of(Hash)
235
+ end
236
+
219
237
  it "GRAPH: Create" do
220
238
  gitems = {
221
239
  :itemid => zbx.items.get_id(:description => item),
@@ -223,13 +241,14 @@ describe ZabbixApi, "test_api" do
223
241
  :type => "0",
224
242
  :periods_cnt => "5"
225
243
  }
226
- zbx.graphs.create(
244
+ $graph_id_real = zbx.graphs.create(
227
245
  :gitems => [gitems],
228
246
  :show_triggers => "0",
229
247
  :name => graph,
230
248
  :width => "900",
231
249
  :height => "200"
232
- ).should be_kind_of(Integer)
250
+ )
251
+ $graph_id_real.should be_kind_of(Integer)
233
252
  end
234
253
 
235
254
  it "GRAPH: Create or get" do
@@ -245,21 +264,25 @@ describe ZabbixApi, "test_api" do
245
264
  :name => graph,
246
265
  :width => "900",
247
266
  :height => "200"
248
- ).should be_kind_of(Integer)
267
+ ).should equal $graph_id_real
249
268
  end
250
269
 
251
270
  it "GRAPH: Find gititems" do
252
- zbx.graphs.get_items( zbx.graphs.get_id(:name => graph) )
271
+ zbx.graphs.get_items( zbx.graphs.get_id(:name => graph) ).should be_kind_of(Array)
253
272
  end
254
273
 
255
274
  it "GRAPH: Find" do
256
- zbx.graphs.get_id( :name => graph ).should be_kind_of(Integer)
275
+ zbx.graphs.get_id( :name => graph ).should equal $graph_id_real
257
276
  end
258
277
 
259
278
  it "GRAPH: get_ids_by_host" do
260
279
  zbx.graphs.get_ids_by_host( :host => host ).should be_kind_of(Array)
261
280
  end
262
281
 
282
+ it "GRAPH: Get all" do
283
+ zbx.graphs.all.should include(graph => $graph_id_real.to_s)
284
+ end
285
+
263
286
  it "GRAPH: Update" do
264
287
  zbx.graphs.update(
265
288
  :graphid => zbx.graphs.get_id(
@@ -267,7 +290,7 @@ describe ZabbixApi, "test_api" do
267
290
  :hostid => zbx.hosts.get_id(:host => host)
268
291
  ),
269
292
  :ymax_type => 1
270
- ).should be_kind_of(Integer)
293
+ ).should equal $graph_id_real
271
294
  end
272
295
 
273
296
  it "GRAPH: Create or Update" do
@@ -283,14 +306,15 @@ describe ZabbixApi, "test_api" do
283
306
  :name => graph,
284
307
  :width => "900",
285
308
  :height => "200"
286
- ).should be_kind_of(Integer)
309
+ ).should equal $graph_id_real
287
310
  end
288
311
 
289
312
  it "SCREEN: Get or create for host" do
290
- zbx.screens.get_or_create_for_host(
313
+ $screen_id_real = zbx.screens.get_or_create_for_host(
291
314
  :host => host,
292
315
  :graphids => zbx.graphs.get_ids_by_host(:host => host)
293
- ).should be_kind_of(Integer)
316
+ )
317
+ $screen_id_real.should be_kind_of(Integer)
294
318
  end
295
319
 
296
320
  it "TEMPLATE: Unlink hosts from templates" do
@@ -300,10 +324,14 @@ describe ZabbixApi, "test_api" do
300
324
  ).should be_kind_of(TrueClass)
301
325
  end
302
326
 
327
+ it "SCREEN: Get all" do
328
+ zbx.screens.all.should be_kind_of(Hash)
329
+ end
330
+
303
331
  it "SCREEN: Delete" do
304
332
  zbx.screens.delete(
305
333
  [zbx.screens.get_id(:name => "#{host}_graphs")]
306
- ).should be_kind_of(Integer)
334
+ ).should equal $screen_id_real
307
335
  end
308
336
 
309
337
  it "GRAPH: Delete" do
@@ -315,36 +343,37 @@ describe ZabbixApi, "test_api" do
315
343
  end
316
344
 
317
345
  it "HOST: Delete" do
318
- zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should be_kind_of(Integer)
346
+ zbx.hosts.delete( zbx.hosts.get_id(:host => host) ).should equal $host_id_real
319
347
  end
320
348
 
321
349
  it "ITEM: Delete" do
322
350
  zbx.items.delete(
323
351
  zbx.items.get_id(:description => item)
324
- ).should be_kind_of(Integer)
352
+ ).should equal $item_id_real
325
353
  end
326
354
 
327
355
  it "APPLICATION: Delete" do
328
- zbx.applications.delete( zbx.applications.get_id(:name => application) )
356
+ zbx.applications.delete( zbx.applications.get_id(:name => application) ).should equal $application_id_real
329
357
  end
330
358
 
331
359
  it "TEMPLATE: Delete" do
332
- zbx.templates.delete(zbx.templates.get_id(:host => template))
360
+ zbx.templates.delete(zbx.templates.get_id(:host => template)).should equal $template_id_real
333
361
  end
334
362
 
335
363
  it "HOSTGROUP: Delete" do
336
364
  zbx.hostgroups.delete(
337
365
  zbx.hostgroups.get_id(:name => hostgroup)
338
- ).should be_kind_of(Integer)
366
+ ).should equal $hostgroup_id_real
339
367
  end
340
368
 
341
369
  it "USER: Create" do
342
- zbx.users.create(
370
+ $user_id_real = zbx.users.create(
343
371
  :alias => "Test #{user}",
344
372
  :name => user,
345
373
  :surname => user,
346
374
  :passwd => user
347
- ).should be_kind_of(Integer)
375
+ )
376
+ $user_id_real.should be_kind_of(Integer)
348
377
  end
349
378
 
350
379
  it "USER: Create or update" do
@@ -353,34 +382,31 @@ describe ZabbixApi, "test_api" do
353
382
  :name => user,
354
383
  :surname => user,
355
384
  :passwd => user
356
- ).should be_kind_of(Integer)
357
- end
358
-
359
- it "USER: Find" do
360
- zbx.users.get_full_data(:name => user)[0]['name'].should be_kind_of(String)
385
+ ).should equal $user_id_real
361
386
  end
362
387
 
363
388
  it "USER: Update" do
364
- zbx.users.update(:userid => zbx.users.get_id(:name => user), :name => user2).should be_kind_of(Integer)
389
+ zbx.users.update(:userid => zbx.users.get_id(:name => user), :name => user2).should equal $user_id_real
365
390
  end
366
391
 
367
392
  it "USER: Find unknown" do
368
- zbx.users.get_id(:name => "#{user}_____")
393
+ zbx.users.get_id(:name => "#{user}_____").should be_kind_of(NilClass)
369
394
  end
370
395
 
371
396
  it "USERGROUPS: Create" do
372
- zbx.usergroups.create(:name => usergroup).should be_kind_of(Integer)
397
+ $usergrp_id_real = zbx.usergroups.create(:name => usergroup)
398
+ $usergrp_id_real.should be_kind_of(Integer)
373
399
  end
374
400
 
375
401
  it "USERGROUPS: Create or update" do
376
- zbx.usergroups.get_or_create(:name => usergroup).should be_kind_of(Integer)
402
+ zbx.usergroups.get_or_create(:name => usergroup).should equal $usergrp_id_real
377
403
  end
378
404
 
379
405
  it "USERGROUPS: Add user" do
380
406
  zbx.usergroups.add_user(
381
407
  :usrgrpids => [zbx.usergroups.get_id(:name => usergroup)],
382
408
  :userids => [zbx.users.get_id(:name => user2)]
383
- ).should be_kind_of(Integer)
409
+ ).should equal $usergrp_id_real
384
410
  end
385
411
 
386
412
  it "USERGROUPS: Set UserGroup read & write perm" do
@@ -388,23 +414,24 @@ describe ZabbixApi, "test_api" do
388
414
  :usrgrpid => zbx.usergroups.get_or_create(:name => usergroup).to_s,
389
415
  :hostgroupids => zbx.hostgroups.all.values,
390
416
  :permission => 3
391
- ).should be_kind_of(Integer)
417
+ ).should equal $usergrp_id_real
392
418
  end
393
419
 
394
420
  it "MEDIATYPE: Create" do
395
- zbx.mediatypes.create(
421
+ $meditype_id_real = zbx.mediatypes.create(
396
422
  :description => mediatype,
397
423
  :type => 0,
398
424
  :smtp_server => "127.0.0.1",
399
425
  :smtp_email => "zabbix@test.com"
400
- ).should be_kind_of(Integer)
426
+ )
427
+ $meditype_id_real.should be_kind_of(Integer)
401
428
  end
402
429
 
403
430
  it "MEDIATYPE: Update or create" do
404
431
  zbx.mediatypes.create_or_update(
405
432
  :description => mediatype,
406
433
  :smtp_email => "zabbix2@test.com"
407
- ).should be_kind_of(Integer)
434
+ ).should equal $meditype_id_real
408
435
  end
409
436
 
410
437
  it "USER: Add mediatype" do
@@ -419,21 +446,21 @@ describe ZabbixApi, "test_api" do
419
446
  :severity => "56"
420
447
  }
421
448
  ]
422
- ).should be_kind_of(Integer)
449
+ ).should equal $user_id_real
423
450
  end
424
451
 
425
452
  it "MEDIATYPE: Delete" do
426
453
  zbx.mediatypes.delete(
427
454
  zbx.mediatypes.get_id(:description => mediatype)
428
- ).should be_kind_of(Integer)
455
+ ).should equal $meditype_id_real
429
456
  end
430
457
 
431
458
  it "USER: Delete" do
432
- zbx.users.delete(zbx.users.get_id(:name => user2)).should be_kind_of(Integer)
459
+ zbx.users.delete(zbx.users.get_id(:name => user2)).should equal $user_id_real
433
460
  end
434
461
 
435
462
  it "USERGROUPS: Delete" do
436
- zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should be_kind_of(Integer)
463
+ zbx.usergroups.delete([zbx.usergroups.get_id(:name => usergroup)]).should equal $usergrp_id_real
437
464
  end
438
465
 
439
466
  it "QUERY" do