spec/support/fixture_data.rb in flapjack-diner-2.0.0b1 vs spec/support/fixture_data.rb in flapjack-diner-2.0.0.pre.alpha.1
- old
+ new
@@ -38,27 +38,27 @@
ret = data
end
ret
end
+ # def contextify(resp_data)
+
+ # end
+
def check_data
@check_data ||= {
:id => '1ed80833-6d28-4aba-8603-d81c249b8c23',
:name => 'www.example.com:SSH',
- :enabled => true,
- :initial_failure_delay => nil,
- :repeat_failure_delay => nil
+ :enabled => true
}
end
def check_2_data
@check_2_data ||= {
:id => '29e913cf-29ea-4ae5-94f6-7069cf4a1514',
:name => 'www2.example.com:PING',
- :enabled => true,
- :initial_failure_delay => nil,
- :repeat_failure_delay => nil
+ :enabled => true
}
end
def check_json(ch_data)
id = ch_data[:id]
@@ -72,66 +72,66 @@
def check_rel(ch_data)
id = ch_data[:id]
{
:alerting_media => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/alerting_media",
- :related => "http://#{api_host}/checks/#{id}/alerting_media"
+ :self => "http://example.org/checks/#{id}/relationships/alerting_media",
+ :related => "http://example.org/checks/#{id}/alerting_media"
}
},
:contacts => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/contacts",
- :related => "http://#{api_host}/checks/#{id}/contacts"
+ :self => "http://example.org/checks/#{id}/relationships/contacts",
+ :related => "http://example.org/checks/#{id}/contacts"
}
},
:current_scheduled_maintenances => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/current_scheduled_maintenances",
- :related => "http://#{api_host}/checks/#{id}/current_scheduled_maintenances"
+ :self => "http://example.org/checks/#{id}/relationships/current_scheduled_maintenances",
+ :related => "http://example.org/checks/#{id}/current_scheduled_maintenances"
}
},
:current_state => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/current_state",
- :related => "http://#{api_host}/checks/#{id}/current_state"
+ :self => "http://example.org/checks/#{id}/relationships/current_state",
+ :related => "http://example.org/checks/#{id}/current_state"
}
},
:current_unscheduled_maintenance => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/current_unscheduled_maintenance",
- :related => "http://#{api_host}/checks/#{id}/current_unscheduled_maintenance"
+ :self => "http://example.org/checks/#{id}/relationships/current_unscheduled_maintenance",
+ :related => "http://example.org/checks/#{id}/current_unscheduled_maintenance"
}
},
:latest_notifications => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/latest_notifications",
- :related => "http://#{api_host}/checks/#{id}/latest_notifications"
+ :self => "http://example.org/checks/#{id}/relationships/latest_notifications",
+ :related => "http://example.org/checks/#{id}/latest_notifications"
}
},
:scheduled_maintenances => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/scheduled_maintenances",
- :related => "http://#{api_host}/checks/#{id}/scheduled_maintenances"
+ :self => "http://example.org/checks/#{id}/relationships/scheduled_maintenances",
+ :related => "http://example.org/checks/#{id}/scheduled_maintenances"
}
},
:states => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/states",
- :related => "http://#{api_host}/checks/#{id}/states"
+ :self => "http://example.org/checks/#{id}/relationships/states",
+ :related => "http://example.org/checks/#{id}/states"
}
},
:tags => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/tags",
- :related => "http://#{api_host}/checks/#{id}/tags"
+ :self => "http://example.org/checks/#{id}/relationships/tags",
+ :related => "http://example.org/checks/#{id}/tags"
}
},
:unscheduled_maintenances => {
:links => {
- :self => "http://#{api_host}/checks/#{id}/relationships/unscheduled_maintenances",
- :related => "http://#{api_host}/checks/#{id}/unscheduled_maintenances"
+ :self => "http://example.org/checks/#{id}/relationships/unscheduled_maintenances",
+ :related => "http://example.org/checks/#{id}/unscheduled_maintenances"
}
}
}
end
@@ -177,16 +177,10 @@
:rules => {
:links => {
:self => "http://#{api_host}/contacts/#{id}/relationships/rules",
:related => "http://#{api_host}/contacts/#{id}/rules"
}
- },
- :tags => {
- :links => {
- :self => "http://#{api_host}/contacts/#{id}/relationships/tags",
- :related => "http://#{api_host}/contacts/#{id}/tags"
- }
}
}
end
def scheduled_maintenance_data
@@ -236,12 +230,12 @@
def maintenance_rel(type, m_data)
id = m_data[:id]
{
:check => {
:links => {
- :self => "http://#{api_host}/#{type}_maintenances/#{id}/relationships/check",
- :related => "http://#{api_host}/#{type}_maintenances/#{id}/check"
+ :self => "http://example.org/#{type}_maintenances/#{id}/relationships/check",
+ :related => "http://example.org/#{type}_maintenances/#{id}/check"
}
}
}
end
@@ -305,23 +299,19 @@
end
def rule_data
@rule_data ||= {
:id => '05983623-fcef-42da-af44-ed6990b500fa',
- :enabled => true,
- :blackhole => false,
- :strategy => 'all_tags',
+ :is_blackhole => false,
:conditions_list => 'critical'
}
end
def rule_2_data
@rule_2_data ||= {
:id => '20f182fc-6e32-4794-9007-97366d162c51',
- :enabled => true,
- :blackhole => true,
- :strategy => 'all_tags',
+ :is_blackhole => false,
:conditions_list => 'warning'
}
end
def rule_json(ru_data)
@@ -335,44 +325,44 @@
def rule_rel(ru_data)
id = ru_data[:id]
{
:contact => {
:links => {
- :self => "http://#{api_host}/rules/#{id}/relationships/contact",
- :related => "http://#{api_host}/rules/#{id}/contact"
+ :self => "http://example.org/rules/#{id}/relationships/contact",
+ :related => "http://example.org/rules/#{id}/contact"
}
},
:media => {
:links => {
- :self => "http://#{api_host}/rules/#{id}/relationships/media",
- :related => "http://#{api_host}/rules/#{id}/media"
+ :self => "http://example.org/rules/#{id}/relationships/media",
+ :related => "http://example.org/rules/#{id}/media"
}
},
:tags => {
:links => {
- :self => "http://#{api_host}/rules/#{id}/relationships/tags",
- :related => "http://#{api_host}/rules/#{id}/tags"
+ :self => "http://example.org/rules/#{id}/relationships/tags",
+ :related => "http://example.org/rules/#{id}/tags"
}
}
}
end
def state_data
@state_data ||= {
:id => '142acf62-31e7-4074-ada9-a30ae73d880d',
:created_at => (fixture_time - 30).iso8601,
:updated_at => (fixture_time - 30).iso8601,
- :condition => 'critical',
+ :condition => 'critical'
}
end
def state_2_data
@state_2_data ||= {
:id => '008d78fc-1c72-4c2a-8057-0d44b64c6f3d',
:created_at => (fixture_time - 10).iso8601,
:updated_at => (fixture_time - 10).iso8601,
- :condition => 'ok',
+ :condition => 'ok'
}
end
def state_json(st_data)
id = st_data[:id]
@@ -386,76 +376,49 @@
def state_rel(st_data)
id = st_data[:id]
{
:check => {
:links => {
- :self => "http://#{api_host}/states/#{id}/relationships/check",
- :related => "http://#{api_host}/states/#{id}/check"
+ :self => "http://example.org/states/#{id}/relationships/check",
+ :related => "http://example.org/states/#{id}/check"
}
}
}
end
def tag_data
@tag_data ||= {
- :id => '1850b8d7-1055-4a6e-9c96-f8f50e55bd0f',
:name => 'database',
}
end
def tag_2_data
@tag_2_data ||= {
- :id => 'c7a12328-8902-4974-8efa-68ec3e284507',
:name => 'physical',
}
end
def tag_json(ta_data)
- id = ta_data[:id]
+ id = ta_data[:name]
{
- :id => id,
:type => 'tag',
- :attributes => ta_data.reject {|k,v| :id.eql?(k) }
+ :attributes => ta_data
}
end
def tag_rel(ta_data)
- id = ta_data[:id]
+ id = ta_data[:name]
{
:checks => {
:links => {
:self => "http://#{api_host}/tags/#{id}/relationships/checks",
:related => "http://#{api_host}/tags/#{id}/checks"
}
},
- :contacts => {
- :links => {
- :self => "http://#{api_host}/tags/#{id}/relationships/contacts",
- :related => "http://#{api_host}/tags/#{id}/contacts"
- }
- },
:rules => {
:links => {
:self => "http://#{api_host}/tags/#{id}/relationships/rules",
:related => "http://#{api_host}/tags/#{id}/rules"
- }
- },
- :scheduled_maintenances => {
- :links => {
- :self => "http://#{api_host}/tags/#{id}/relationships/scheduled_maintenances",
- :related => "http://#{api_host}/tags/#{id}/scheduled_maintenances"
- }
- },
- :states => {
- :links => {
- :self => "http://#{api_host}/tags/#{id}/relationships/states",
- :related => "http://#{api_host}/tags/#{id}/states"
- }
- },
- :unscheduled_maintenances => {
- :links => {
- :self => "http://#{api_host}/tags/#{id}/relationships/unscheduled_maintenances",
- :related => "http://#{api_host}/tags/#{id}/unscheduled_maintenances"
}
}
}
end
\ No newline at end of file