tests config
This commit is contained in:
parent
281a42605f
commit
fa4ac495c9
@ -1,7 +0,0 @@
|
||||
host: "host"
|
||||
port: port
|
||||
username: "test"
|
||||
password: "test"
|
||||
path_prefix: ""
|
||||
username_without_privileges: "user_for_testing_"
|
||||
password_without_privileges: "test"
|
||||
64
devops-service/tests/features/api_v2/00_list/flavor.feature
Normal file
64
devops-service/tests/features/api_v2/00_list/flavor.feature
Normal file
@ -0,0 +1,64 @@
|
||||
@flavor
|
||||
Feature: Flavors
|
||||
|
||||
@openstack
|
||||
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"
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
@ec2
|
||||
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
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
@static
|
||||
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
|
||||
|
||||
@static
|
||||
Scenario: Get flavors list of static provider without 'Accept' header
|
||||
When I send GET '/v2.0/flavors/static' query without headers 'Accept'
|
||||
Then response should be '406'
|
||||
|
||||
Scenario: Get flavors list of unknown provider
|
||||
When I send GET '/v2.0/flavors/foo' query
|
||||
Then response should be '404'
|
||||
|
||||
Scenario: Get flavors list of unknown provider without 'Accept' header
|
||||
When I send GET '/v2.0/flavors/foo' query without headers 'Accept'
|
||||
Then response should be '406'
|
||||
|
||||
Scenario: Get flavors list of unknown provider without privileges
|
||||
When I send GET '/v2.0/flavors/foo' query with user without privileges
|
||||
Then response should be '401'
|
||||
8
devops-service/tests/features/support/config.yml
Normal file
8
devops-service/tests/features/support/config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
host: host
|
||||
port: 7070
|
||||
username: test
|
||||
password: test
|
||||
path_prefix: ''
|
||||
username_without_privileges: user_for_testing_
|
||||
password_without_privileges: test
|
||||
@ -7,10 +7,20 @@ require "fileutils"
|
||||
|
||||
class Generator < OpenStruct
|
||||
|
||||
CONFIG = "config.yml"
|
||||
CONFIG = "params.yml"
|
||||
TESTS_CONFIG = "features/support/config.yml"
|
||||
|
||||
def initialize
|
||||
super(:config => YAML.load_file(File.new(ENV["CONFIG"] || CONFIG)))
|
||||
@config = YAML.load_file(File.new(ENV["CONFIG"] || CONFIG))
|
||||
super(:config => @config)
|
||||
end
|
||||
|
||||
def make_tests_config
|
||||
c = {}
|
||||
%w{host port username password path_prefix username_without_privileges password_without_privileges}.each do |key|
|
||||
c[key] = @config[key]
|
||||
end
|
||||
File.open(TESTS_CONFIG, "w") {|f| f.write(c.to_yaml) }
|
||||
end
|
||||
|
||||
def render(template)
|
||||
@ -22,6 +32,7 @@ templates = {
|
||||
"templates/api_v2/00_list/flavor.feature.erb" => "features/api_v2/00_list/flavor.feature"
|
||||
}
|
||||
generator = Generator.new
|
||||
generator.make_tests_config
|
||||
|
||||
templates.each do |input, output|
|
||||
if File.exists?(input)
|
||||
|
||||
@ -1,4 +1,12 @@
|
||||
---
|
||||
host: "host"
|
||||
port: 7070
|
||||
username: "test"
|
||||
password: "test"
|
||||
path_prefix: ""
|
||||
username_without_privileges: "user_for_testing_"
|
||||
password_without_privileges: "test"
|
||||
|
||||
openstack:
|
||||
flavor: "as_long_as_image"
|
||||
image: "08093b30-8393-42c3-8fb3-c4df56deb967"
|
||||
Loading…
Reference in New Issue
Block a user