few fixes, added image update template

This commit is contained in:
Tim Lianov 2014-07-15 11:34:42 +04:00
parent 08667ea83e
commit 2432e2f42c
4 changed files with 446 additions and 4 deletions

View File

@ -30,7 +30,11 @@ class Generator < OpenStruct
end end
templates = { templates = {
#list
"templates/api_v2/00_list/flavor.feature.erb" => "features/api_v2/00_list/flavor.feature", "templates/api_v2/00_list/flavor.feature.erb" => "features/api_v2/00_list/flavor.feature",
#create
"templates/api_v2/10_create/00_filter.feature.erb" => "features/api_v2/10_create/00_filter.feature", "templates/api_v2/10_create/00_filter.feature.erb" => "features/api_v2/10_create/00_filter.feature",
"templates/api_v2/10_create/10_image.feature.erb" => "features/api_v2/10_create/10_image.feature", "templates/api_v2/10_create/10_image.feature.erb" => "features/api_v2/10_create/10_image.feature",
"templates/api_v2/10_create/20_project.feature.erb" => "features/api_v2/10_create/20_project.feature", "templates/api_v2/10_create/20_project.feature.erb" => "features/api_v2/10_create/20_project.feature",

View File

@ -516,7 +516,6 @@ Feature: Manage images
@ec2 @ec2
Scenario: Get info for single ec2 image Scenario: Get info for single ec2 image
When I send GET '<%= @config["ec2"]["image"] %>' query When I send GET '<%= @config["ec2"]["image"] %>' query
"id": "<%= @config["ec2"]["image"] %>"
Then response should be '200' Then response should be '200'
And the Content-Type header should include 'application/json' And the Content-Type header should include 'application/json'
And the JSON response should be an object And the JSON response should be an object
@ -534,13 +533,11 @@ Feature: Manage images
@ec2 @ec2
Scenario: Get info for single ec2 image without headers 'Accept' Scenario: Get info for single ec2 image without headers 'Accept'
When I send GET '<%= @config["ec2"]["image"] %>' query without headers 'Accept' When I send GET '<%= @config["ec2"]["image"] %>' query without headers 'Accept'
"id": "<%= @config["ec2"]["image"] %>"
Then response should be '406' Then response should be '406'
@ec2 @ec2
Scenario: Get ec2 image without privileges Scenario: Get ec2 image without privileges
When I send GET '<%= @config["ec2"]["image"] %>' query with user without privileges When I send GET '<%= @config["ec2"]["image"] %>' query with user without privileges
"id": "<%= @config["ec2"]["image"] %>"
Then response should be '401' Then response should be '401'
@openstack @openstack

View File

@ -56,4 +56,3 @@ Feature: create project
} }
""" """
Then response should be '201' Then response should be '201'

View File

@ -0,0 +1,442 @@
@image @project
Feature: Update images
@openstack
Scenario: Update openstack image with ec2 provider
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid provider
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "foo",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid provider - array
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": ["foo"],
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid provider - hash
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": {},
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid name - hash
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": {},
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid name - array
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": [],
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid remote_user - hash
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": {},
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid remote_user - array
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": [],
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid bootstrap_template - array
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": [],
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid bootstrap_template - hash
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": {},
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid bootstrap_template - unknown
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "unknown",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '400'
@openstack
Scenario: Update openstack image with invalid id - array
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": []
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""
@openstack
Scenario: Update openstack image with invalid id - hash
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": {}
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""
@openstack
Scenario: Update openstack image
When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "freebsd-10.0",
"remote_user": "root",
"bootstrap_template": "chef_freebsd",
"id": "<%= @config["openstack"]["image"] %>"
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""
@ec2
Scenario: Update ec2 image with openstack provider
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "openstack",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid provider
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "foo",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid provider - array
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": ["foo"],
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid provider - hash
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": {},
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid name - hash
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": {},
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid name - array
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": [],
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid remote_user - hash
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": {},
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid remote_user - array
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": [],
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid bootstrap_template - array
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": [],
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid bootstrap_template - hash
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": {},
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid bootstrap_template - unknown
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": "unknown",
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '400'
@ec2
Scenario: Update ec2 image with invalid id - array
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": []
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""
@ec2
Scenario: Update ec2 image with invalid id - hash
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": {}
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""
@ec2
Scenario: Update ec2 image
When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body
"""
{
"provider": "ec2",
"name": "test-ec2",
"remote_user": "ec2-user",
"bootstrap_template": null,
"id": "<%= @config["ec2"]["image"] %>"
}
"""
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object
And response should be JSON object like:
"""
{
"message" : "Image '<%= @config["openstack"]["image"] %>' has been updated"
}
"""