network tests
This commit is contained in:
parent
4585a7f26f
commit
5893398314
59
devops-service/features/api_v2/network.feature
Normal file
59
devops-service/features/api_v2/network.feature
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
@network
|
||||||
|
Feature: Networks
|
||||||
|
|
||||||
|
@openstack
|
||||||
|
Scenario: Get list of openstack networks
|
||||||
|
When I send GET '/v2.0/networks/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:
|
||||||
|
"""
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"cidr": "192.168.0.0/16",
|
||||||
|
"name": "private",
|
||||||
|
"id": "net_id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"""
|
||||||
|
|
||||||
|
@ec2
|
||||||
|
Scenario: Get list of ec2 networks
|
||||||
|
When I send GET '/v2.0/networks/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:
|
||||||
|
"""
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"cidr": "192.168.0.0/16",
|
||||||
|
"name": "private",
|
||||||
|
"zone": "net_zone",
|
||||||
|
"vpcId": "vpcId",
|
||||||
|
"subnetId": "subnetId"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"""
|
||||||
|
|
||||||
|
@static
|
||||||
|
Scenario: Get list of static networks
|
||||||
|
When I send GET '/v2.0/networks/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
|
||||||
|
|
||||||
|
@static
|
||||||
|
Scenario: Get networks list of static provider without 'Accept' header
|
||||||
|
When I send GET '/v2.0/networks/static' query without headers 'Accept'
|
||||||
|
Then response should be '406'
|
||||||
|
|
||||||
|
Scenario: Get networks list of unknown provider
|
||||||
|
When I send GET '/v2.0/networks/foo' query
|
||||||
|
Then response should be '404'
|
||||||
|
|
||||||
|
Scenario: Get networks list of unknown provider without 'Accept' header
|
||||||
|
When I send GET '/v2.0/networks/foo' query without headers 'Accept'
|
||||||
|
Then response should be '406'
|
||||||
14
devops-service/features/step_definitions/network_steps.rb
Normal file
14
devops-service/features/step_definitions/network_steps.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Then(/^response array should be empty or contains elements like:$/) do |string|
|
||||||
|
src = JSON.parse(string).first
|
||||||
|
array = JSON.parse(last_response.body)
|
||||||
|
if array.empty?
|
||||||
|
assert true
|
||||||
|
else
|
||||||
|
array.each do |e|
|
||||||
|
src.each do |key, value|
|
||||||
|
assert e.key?(key), "Element #{e.inspect} has no key '#{key}'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@ -35,6 +35,10 @@ module Provider
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def networks_detail
|
||||||
|
self.networks
|
||||||
|
end
|
||||||
|
|
||||||
def servers
|
def servers
|
||||||
@@mongo.servers_find({:provider => PROVIDER}).map{|s| s.to_hash}
|
@@mongo.servers_find({:provider => PROVIDER}).map{|s| s.to_hash}
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user