spec/localhost.rb in zabbixapi-0.4.3 vs spec/localhost.rb in zabbixapi-0.4.4
- old
+ new
@@ -43,21 +43,28 @@
it "HOSTGROUP: Find unknown" do
zbx.hostgroups.get_id(:name => "#{hostgroup}______").should be_kind_of(NilClass)
end
- it "HOSTGROUP: Create or update" do
- zbx.hostgroups.create_or_update(:name => hostgroup).should be_kind_of(Integer)
+ it "HOSTGROUP: Create or get" do
+ zbx.hostgroups.get_or_create(:name => hostgroup).should be_kind_of(Integer)
end
it "TEMPLATE: Create" do
zbx.templates.create(
:host => template,
:groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
).should be_kind_of(Integer)
end
+ it "TEMPLATE: Get get or create" do
+ zbx.templates.get_or_create(
+ :host => template,
+ :groups => [:groupid => zbx.hostgroups.get_id(:name => hostgroup)]
+ ).should be_kind_of(Integer)
+ end
+
it "TEMPLATE: Check full data" do
zbx.templates.get_full_data(:host => template)[0]['host'].should be_kind_of(String)
end
it "TEMPLATE: Find" do
@@ -73,10 +80,17 @@
:name => application,
:hostid => zbx.templates.get_id(:host => template)
)
end
+ it "APPLICATION: Get or create" do
+ zbx.applications.get_or_create(
+ :name => application,
+ :hostid => zbx.templates.get_id(:host => template)
+ )
+ end
+
it "APPLICATION: Full info check" do
zbx.applications.get_full_data(:name => application)[0]['applicationid'].should be_kind_of(String)
end
it "APPLICATION: Find" do
@@ -162,9 +176,16 @@
).should be_kind_of(Array)
end
it "TEMPLATE: Linked hosts with templates" do
zbx.templates.mass_add(
+ :hosts_id => [zbx.hosts.get_id(:host => host)],
+ :templates_id => [zbx.templates.get_id(:host => template)]
+ ).should be_kind_of(TrueClass)
+ end
+
+ it "TEMPLATE: Update hosts with templates" do
+ zbx.templates.mass_update(
:hosts_id => [zbx.hosts.get_id(:host => host)],
:templates_id => [zbx.templates.get_id(:host => template)]
).should be_kind_of(TrueClass)
end