flavor tests
This commit is contained in:
parent
10eaf25454
commit
bfbf56e08d
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
module I18n
|
||||
|
||||
@@lang = {}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
ru:
|
||||
config:
|
||||
invalid:
|
||||
|
||||
47
devops-service/features/flavor.feature
Normal file
47
devops-service/features/flavor.feature
Normal file
@ -0,0 +1,47 @@
|
||||
Feature: flavors
|
||||
|
||||
@flavor
|
||||
Scenario: Get list of openstack flavors
|
||||
When I send GET '/v2.0/flavors/openstack' query
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an array
|
||||
And response array should contains elements like:
|
||||
"""
|
||||
[
|
||||
{
|
||||
"id" => "flavor_id",
|
||||
"v_cpus" => "v_cpus",
|
||||
"ram" => "ram",
|
||||
"disk" => "disk"
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
@flavor
|
||||
Scenario: Get list of ec2 flavors
|
||||
When I send GET '/v2.0/flavors/ec2' query
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an array
|
||||
And response array should contains elements like:
|
||||
"""
|
||||
[
|
||||
{
|
||||
"id": "t1.micro",
|
||||
"cores": 2,
|
||||
"disk": 0,
|
||||
"name": "Micro Instance",
|
||||
"ram": 613
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
@flavor
|
||||
Scenario: Get list of static flavors
|
||||
When I send GET '/v2.0/flavors/static' query
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an array
|
||||
And response array should be empty
|
||||
|
||||
@ -5,7 +5,7 @@ Feature: Manage images
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an array
|
||||
And response should be JSON, images list:
|
||||
And response array should contains elements like:
|
||||
"""
|
||||
[
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@ DEFAULT_HEADERS = {
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
When(/^I send GET '(.*)' query$/) do |path|
|
||||
puts path
|
||||
get(path, {}, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ Then(/^the JSON response should be a hash$/) do
|
||||
assert body.is_a?(Hash), "Body is not a hash"
|
||||
end
|
||||
|
||||
=begin
|
||||
Then(/^response should be JSON, images list:$/) do |string|
|
||||
src_image = JSON.parse(string).first
|
||||
image = JSON.parse(last_response.body).first
|
||||
@ -30,6 +31,7 @@ Then(/^response should be JSON, images list:$/) do |string|
|
||||
assert image.key?(key), "Image has no key '#{key}'"
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
Then(/^response should be JSON, image object:$/) do |string|
|
||||
src_image = JSON.parse(string)
|
||||
|
||||
14
devops-service/features/step_definitions/json_steps.rb
Normal file
14
devops-service/features/step_definitions/json_steps.rb
Normal file
@ -0,0 +1,14 @@
|
||||
Then(/^response array should contains elements like:$/) do |string|
|
||||
src = JSON.parse(string).first
|
||||
array = JSON.parse(last_response.body)
|
||||
array.each do |e|
|
||||
src.each do |key, value|
|
||||
assert e.key?(key), "Element #{e.inspect} has no key '#{key}'"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^response array should be empty$/) do
|
||||
array = JSON.parse(last_response.body)
|
||||
assert array.empty?, "Array is not empty"
|
||||
end
|
||||
@ -182,6 +182,9 @@ module Provider
|
||||
end
|
||||
end
|
||||
|
||||
def compute
|
||||
connection_compute(connection_options)
|
||||
end
|
||||
private
|
||||
def convert_groups list
|
||||
res = {}
|
||||
@ -231,10 +234,5 @@ module Provider
|
||||
end
|
||||
r
|
||||
end
|
||||
|
||||
private
|
||||
def compute
|
||||
connection_compute(connection_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -182,6 +182,13 @@ module Provider
|
||||
return nil
|
||||
end
|
||||
|
||||
def compute
|
||||
connection_compute(self.connection_options)
|
||||
end
|
||||
|
||||
def network
|
||||
connection_network(self.connection_options)
|
||||
end
|
||||
private
|
||||
def convert_groups list
|
||||
res = {}
|
||||
@ -203,13 +210,5 @@ module Provider
|
||||
res
|
||||
end
|
||||
|
||||
def compute
|
||||
connection_compute(self.connection_options)
|
||||
end
|
||||
|
||||
def network
|
||||
connection_network(self.connection_options)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user