tests: directories structure for tests order
This commit is contained in:
parent
693ad79d4f
commit
59aba6b860
@ -138,6 +138,7 @@ module ServerCommands
|
||||
end
|
||||
bo.close
|
||||
status = $?.to_i
|
||||
out << "\nBootstrap exit status: #{status}\n"
|
||||
end
|
||||
return status
|
||||
end
|
||||
|
||||
29
devops-service/features/api_v2/10_create/00_filter.feature
Normal file
29
devops-service/features/api_v2/10_create/00_filter.feature
Normal file
@ -0,0 +1,29 @@
|
||||
@filter
|
||||
Feature: Filters
|
||||
|
||||
@openstack
|
||||
Scenario: Add openstack image filter
|
||||
When I send PUT '/v2.0/filter/openstack/image' query with JSON body
|
||||
"""
|
||||
[
|
||||
"08093b30-8393-42c3-8fb3-c4df56deb967"
|
||||
]
|
||||
"""
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an object
|
||||
And the object should contains key 'images' with array and array should contains strings '08093b30-8393-42c3-8fb3-c4df56deb967'
|
||||
|
||||
@ec2
|
||||
Scenario: Add ec2 image filter
|
||||
When I send PUT '/v2.0/filter/ec2/image' query with JSON body
|
||||
"""
|
||||
[
|
||||
"ami-63071b0a"
|
||||
]
|
||||
"""
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an object
|
||||
And the object should contains key 'images' with array and array should contains strings 'ami-63071b0a'
|
||||
|
||||
29
devops-service/features/api_v2/20_delete/99_filter.feature
Normal file
29
devops-service/features/api_v2/20_delete/99_filter.feature
Normal file
@ -0,0 +1,29 @@
|
||||
@filter
|
||||
Feature: Filters
|
||||
|
||||
@openstack
|
||||
Scenario: Delete openstack image filter
|
||||
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
|
||||
"""
|
||||
[
|
||||
"08093b30-8393-42c3-8fb3-c4df56deb967"
|
||||
]
|
||||
"""
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an object
|
||||
And the object should contains key 'images' with array and array should not contains strings '08093b30-8393-42c3-8fb3-c4df56deb967'
|
||||
|
||||
@ec2
|
||||
Scenario: Delete ec2 image filter
|
||||
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
|
||||
"""
|
||||
[
|
||||
"ami-63071b0a"
|
||||
]
|
||||
"""
|
||||
Then response should be '200'
|
||||
And the Content-Type header should include 'application/json'
|
||||
And the JSON response should be an object
|
||||
And the object should contains key 'images' with array and array should not contains strings 'ami-63071b0a'
|
||||
|
||||
@ -27,10 +27,22 @@ When(/^I send POST '(.*)' query with params '(.*)'$/) do |path, params|
|
||||
res = post(path, p, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
When(/^I send POST '(.*)' query with JSON body$/) do |path, body|
|
||||
res = post_body(path, body, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
When(/^I send DELETE '(.*)' query$/) do |path|
|
||||
delete(path, {}, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
When(/^I send DELETE '(.*)' query with JSON body$/) do |path, body|
|
||||
res = delete_body(path, body, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
When(/^I send PUT '(.*)' query with JSON body$/) do |path, body|
|
||||
res = put_body(path, body, DEFAULT_HEADERS)
|
||||
end
|
||||
|
||||
Then(/^response should be '(\d+)'$/) do |code|
|
||||
assert(code.to_i == last_response.status, "Status is not #{code}, it is #{last_response.status}")
|
||||
end
|
||||
|
||||
@ -20,7 +20,7 @@ end
|
||||
|
||||
Then(/^the JSON response should be an array$/) do
|
||||
body = JSON.parse(last_response.body)
|
||||
assert body.is_a?(Array), "Body is not an array"
|
||||
assert body.is_a?(Array), "Body is not an array: #{last_response.body}"
|
||||
end
|
||||
|
||||
Then(/^the JSON response should be an object$/) do
|
||||
@ -42,3 +42,40 @@ Then(/^response should be JSON object like:$/) do |string|
|
||||
assert obj.key?(key), "Object has no key '#{key}'"
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the array should contains strings '(.*)'$/) do |string|
|
||||
buf = string.split(",")
|
||||
array = JSON.parse(last_response.body)
|
||||
buf.each do |v|
|
||||
assert array.include?(v), "Array should contains '#{v}'"
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the array should not contains strings '(.*)'$/) do |string|
|
||||
buf = string.split(",")
|
||||
array = JSON.parse(last_response.body)
|
||||
buf.each do |v|
|
||||
assert !array.include?(v), "Array should not contains '#{v}'"
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the object should contains key '(.*)' with array and array should contains strings '(.*)'$/) do |key, string|
|
||||
buf = string.split(",")
|
||||
obj = JSON.parse(last_response.body)
|
||||
assert obj.key?(key), "Object should has a key '#{key}'"
|
||||
assert obj[key].is_a?(Array), "Object should has an array '#{key}'"
|
||||
buf.each do |v|
|
||||
assert obj[key].include?(v), "'#{key}' array should contains '#{v}'"
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the object should contains key '(.*)' with array and array should not contains strings '(.*)'$/) do |key, string|
|
||||
buf = string.split(",")
|
||||
obj = JSON.parse(last_response.body)
|
||||
assert obj.key?(key), "Object should has a key '#{key}'"
|
||||
assert obj[key].is_a?(Array), "Object should has an array '#{key}'"
|
||||
buf.each do |v|
|
||||
assert !obj[key].include?(v), "'#{key}' array should not contains '#{v}'"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -73,15 +73,30 @@ class RequestSender
|
||||
end
|
||||
|
||||
def post path, query, headers={}
|
||||
post_body(path, JSON.pretty_generate(query), headers)
|
||||
end
|
||||
|
||||
def post_body path, body, headers={}
|
||||
submit do |http|
|
||||
http.receive_timeout = 0 #!!! bring out to appropriate server step
|
||||
http.post(create_url(path), JSON.pretty_generate(query), default_headers.merge(headers))
|
||||
http.post(create_url(path), body, default_headers.merge(headers))
|
||||
end
|
||||
end
|
||||
|
||||
def put_body path, body, headers={}
|
||||
submit do |http|
|
||||
http.receive_timeout = 0 #!!! bring out to appropriate server step
|
||||
http.put(create_url(path), body, default_headers.merge(headers))
|
||||
end
|
||||
end
|
||||
|
||||
def delete path, query, headers={}
|
||||
delete_body(path, JSON.pretty_generate(query), headers)
|
||||
end
|
||||
|
||||
def delete_body path, body, headers={}
|
||||
submit do |http|
|
||||
http.delete(create_url(path), JSON.pretty_generate(query), default_headers.merge(headers))
|
||||
http.delete(create_url(path), body, default_headers.merge(headers))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user