more test templates

This commit is contained in:
Tim Lianov 2014-07-15 12:49:41 +04:00
parent f8efb31aa3
commit e9f32117a9
4 changed files with 282 additions and 1 deletions

View File

@ -44,7 +44,10 @@ templates = {
"templates/api_v2/20_update/10_image.feature.erb" => "features/api_v2/20_update/10_image.feature",
#delete
"templates/api_v2/90_delete/10_script.feature.erb" => "features/api_v2/90_delete/10_script.feature"
"templates/api_v2/90_delete/10_script.feature.erb" => "features/api_v2/90_delete/10_script.feature",
"templates/api_v2/90_delete/80_project.feature.erb" => "features/api_v2/90_delete/80_project.feature",
"templates/api_v2/90_delete/90_image.feature.erb" => "features/api_v2/90_delete/90_image.feature",
"templates/api_v2/90_delete/99_filter.feature.erb" => "features/api_v2/90_delete/99_filter.feature"
}
generator = Generator.new

View File

@ -0,0 +1,53 @@
@project
Feature: delete project
@openstack
Scenario: Delete openstack project with user without privileges
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query with user without privileges
Then response should be '401'
@openstack
Scenario: Delete openstack project without header 'Accept'
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query without header 'Accept'
Then response should be '406'
@openstack
Scenario: Delete openstack project
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query
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" : "Project '<%= @config["openstack"]["project"]["name"] %>' is deleted"
}
"""
@ec2
Scenario: Delete ec2 project with user without privileges
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query with user without privileges
Then response should be '401'
@ec2
Scenario: Delete ec2 project without header 'Accept'
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query without header 'Accept'
Then response should be '406'
@ec2
Scenario: Delete ec2 project
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query
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" : "Project '<%= @config["ec2"]["project"]["name"] %>' is deleted"
}
"""
Scenario: Delete unknown project
When I send DELETE '/v2.0/project/foo' query
Then response should be '404'

View File

@ -0,0 +1,52 @@
@image @project
Feature: delete image
@openstack
Scenario: Delete openstack image with user without privileges
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query with user without privileges
Then response should be '401'
@openstack
Scenario: Delete openstack image without header 'Accept'
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query without header 'Accept'
Then response should be '406'
@openstack
Scenario: Delete openstack image
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query
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 removed"
}
"""
@ec2
Scenario: Delete ec2 image with user without privileges
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query with user without privileges
Then response should be '401'
@ec2
Scenario: Delete ec2 image without header 'Accept'
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query without header 'Accept'
Then response should be '406'
@ec2
Scenario: Delete ec2 image
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query
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["ec2"]["image"] %>' has been removed"
}
"""
Scenario: Delete unknown image
When I send DELETE '/v2.0/image/foo' query
Then response should be '404'

View File

@ -0,0 +1,173 @@
@filter @image @project
Feature: Filters
@openstack
Scenario: Delete openstack image filter with user without privileges
When I send DELETE '/v2.0/filter/openstack/image' query with user without privileges
Then response should be '401'
@openstack
Scenario: Delete openstack image filter without header 'Accept'
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body without header 'Accept'
"""
[
"<%= @config["openstack"]["image"] %>"
]
"""
Then response should be '406'
@openstack
Scenario: Delete openstack image filter without header 'Content-Type'
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body without header 'Content-Type'
"""
[
"<%= @config["openstack"]["image"] %>"
]
"""
Then response should be '415'
@openstack
Scenario: Delete openstack image filter, invalid body: empty
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
"""
Then response should be '400'
@openstack
Scenario: Delete openstack image filter, invalid body: hash
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
{
"foo": "foo"
}
"""
Then response should be '400'
@openstack
Scenario: Delete openstack image filter, invalid body: element is hash
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
[{
"foo": "foo"
}]
"""
Then response should be '400'
@openstack
Scenario: Delete openstack image filter, invalid body: element is array
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
[
[]
]
"""
Then response should be '400'
@openstack
Scenario: Delete openstack image filter, invalid body: element is null
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
[
null
]
"""
Then response should be '400'
@openstack
Scenario: Delete openstack image filter
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body
"""
[
"<%= @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 the object should contains key 'images' with array and array should not contains strings '<%= @config["openstack"]["image"] %>'
@ec2
Scenario: Delete ec2 image filter with user without privileges
When I send DELETE '/v2.0/filter/ec2/image' query with user without privileges
Then response should be '401'
@ec2
Scenario: Delete ec2 image filter without header 'Accept'
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body without header 'Accept'
"""
[
"<%= @config["ec2"]["image"] %>"
]
"""
Then response should be '406'
@ec2
Scenario: Delete ec2 image filter without header 'Content-Type'
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body without header 'Content-Type'
"""
[
"<%= @config["ec2"]["image"] %>"
]
"""
Then response should be '415'
@ec2
Scenario: Delete ec2 image filter, invalid body: empty
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
"""
Then response should be '400'
@ec2
Scenario: Delete ec2 image filter, invalid body: hash
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
{
"foo": "foo"
}
"""
Then response should be '400'
@ec2
Scenario: Delete ec2 image filter, invalid body: element is hash
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
[{
"foo": "foo"
}]
"""
Then response should be '400'
@ec2
Scenario: Delete ec2 image filter, invalid body: element is array
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
[
[]
]
"""
Then response should be '400'
@ec2
Scenario: Delete ec2 image filter, invalid body: element is null
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
[
null
]
"""
Then response should be '400'
@ec2
Scenario: Delete ec2 image filter
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body
"""
[
"<%= @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 the object should contains key 'images' with array and array should not contains strings '<%= @config["ec2"]["image"] %>'