mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
tests for fields and describe analytics requests
This commit is contained in:
parent
db1520952d
commit
d78c5b541d
4 changed files with 48 additions and 0 deletions
|
@ -84,6 +84,19 @@ module Fog
|
||||||
'requested_duration' => 30,
|
'requested_duration' => 30,
|
||||||
'requested_end_time' => Time.now.utc - 570
|
'requested_end_time' => Time.now.utc - 570
|
||||||
}
|
}
|
||||||
|
when :fields
|
||||||
|
{
|
||||||
|
'fields' => {
|
||||||
|
'zonename' => {
|
||||||
|
'label' => 'zone name',
|
||||||
|
'type' => 'string'
|
||||||
|
},
|
||||||
|
'pid' => {
|
||||||
|
'label' => 'process identifier',
|
||||||
|
'type' => 'string'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,15 @@ module Fog
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
def describe_analytics
|
||||||
|
response = Excon::Response.new
|
||||||
|
response.status = 200
|
||||||
|
response.body = self.data[:fields]
|
||||||
|
response
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
13
tests/joyent/models/analytics/fields_tests.rb
Normal file
13
tests/joyent/models/analytics/fields_tests.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Shindo.tests("Fog::Joyent[:analytics] | fields", %w{joyent}) do
|
||||||
|
@analytics = Fog::Joyent[:analytics]
|
||||||
|
@fields = @analytics.fields
|
||||||
|
|
||||||
|
tests('#all').succeeds do
|
||||||
|
@fields.all
|
||||||
|
end
|
||||||
|
|
||||||
|
tests('#new').succeeds do
|
||||||
|
@fields.new(['apache', { 'label' => 'Apache', 'type' => 'string' }])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
Shindo.tests("Fog::Joyent[:analytics] | instrumentation", %w{joyent analytics instrumentation }) do
|
||||||
|
model_tests(Fog::Joyent[:analytics].instrumentations, {:joyent_module => 'cpu', :stat => 'usage'}, true)
|
||||||
|
|
||||||
|
@analytics = Fog::Joyent[:analytics]
|
||||||
|
@instrumentation = @analytics.instrumentations.first
|
||||||
|
|
||||||
|
tests('#values') do
|
||||||
|
@values = @instrumentation.values(Time.now.utc.to_i - 600, 5)
|
||||||
|
|
||||||
|
returns(Array) { @values.class }
|
||||||
|
returns(Fog::Joyent::Analytics::Value) { @values.first.class }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue