a lot of fixes to make tests pass.
This commit is contained in:
parent
beca955f60
commit
7ebceaa8ec
@ -17,7 +17,7 @@ module Devops
|
|||||||
Image.get_available_provider_images(Devops::Db.connector, provider)
|
Image.get_available_provider_images(Devops::Db.connector, provider)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_image id
|
def image id
|
||||||
Devops::Db.connector.image(id)
|
Devops::Db.connector.image(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ module Devops
|
|||||||
Devops::Db.connector.image id
|
Devops::Db.connector.image id
|
||||||
obj = Devops::Model::Image.new(image)
|
obj = Devops::Model::Image.new(image)
|
||||||
obj.id = id
|
obj.id = id
|
||||||
Devops::Db.connector.image_update image
|
Devops::Db.connector.image_update obj
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_image id
|
def delete_image id
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module Devops
|
|||||||
class Key
|
class Key
|
||||||
|
|
||||||
def keys
|
def keys
|
||||||
keys = Devops::DB.connector.keys.map {|i| i.to_hash}
|
keys = Devops::Db.connector.keys.map {|i| i.to_hash}
|
||||||
keys.each {|k| k.delete("path")} # We should not return path to the key
|
keys.each {|k| k.delete("path")} # We should not return path to the key
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -18,11 +18,11 @@ module Devops
|
|||||||
end
|
end
|
||||||
|
|
||||||
key = Devops::Model::Key.new({"path" => file_name, "id" => body["key_name"]})
|
key = Devops::Model::Key.new({"path" => file_name, "id" => body["key_name"]})
|
||||||
Devops::DB.connector.key_insert key
|
Devops::Db.connector.key_insert key
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete key_id
|
def delete key_id
|
||||||
mongo = Devops::DB.connector
|
mongo = Devops::Db.connector
|
||||||
servers = mongo.servers_by_key key_id
|
servers = mongo.servers_by_key key_id
|
||||||
unless servers.empty?
|
unless servers.empty?
|
||||||
s_str = servers.map{|s| s.id}.join(", ")
|
s_str = servers.map{|s| s.id}.join(", ")
|
||||||
@ -33,7 +33,7 @@ module Devops
|
|||||||
begin
|
begin
|
||||||
FileUtils.rm(k.path)
|
FileUtils.rm(k.path)
|
||||||
rescue
|
rescue
|
||||||
logger.error "Missing key file for #{key_id} - #{k.filename}"
|
DevopsLogger.logger.error "Missing key file for #{key_id} - #{k.filename}"
|
||||||
end
|
end
|
||||||
mongo.key_delete key_id
|
mongo.key_delete key_id
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,12 +3,14 @@ require "commands/status"
|
|||||||
require "commands/server"
|
require "commands/server"
|
||||||
require "db/mongo/models/project"
|
require "db/mongo/models/project"
|
||||||
require "workers/project_test_worker"
|
require "workers/project_test_worker"
|
||||||
|
require_relative "../helpers/version_2.rb"
|
||||||
require_relative "request_handler"
|
require_relative "request_handler"
|
||||||
|
|
||||||
module Devops
|
module Devops
|
||||||
module API2_0
|
module API2_0
|
||||||
module Handler
|
module Handler
|
||||||
class Project < RequestHandler
|
class Project < RequestHandler
|
||||||
|
include Devops::API2_0::Helpers
|
||||||
|
|
||||||
extend DeployCommands
|
extend DeployCommands
|
||||||
extend StatusCommands
|
extend StatusCommands
|
||||||
@ -30,20 +32,30 @@ module Devops
|
|||||||
end
|
end
|
||||||
|
|
||||||
def project_servers id
|
def project_servers id
|
||||||
|
# check if project exists
|
||||||
Devops::Db.connector.project(id)
|
Devops::Db.connector.project(id)
|
||||||
Devops::Db.connector.servers(id, @params[:deploy_env])
|
Devops::Db.connector.servers(id, @params[:deploy_env])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def project_stacks id
|
||||||
|
# check if project exists
|
||||||
|
Devops::Db.connector.project(id)
|
||||||
|
options = {project: @params[:project]}
|
||||||
|
options[:deploy_env] = @params[:deploy_env] if @params[:deploy_env]
|
||||||
|
Devops::Db.connector.stacks(options)
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: multi project
|
# TODO: multi project
|
||||||
def create_project body
|
def create_project body
|
||||||
p = Devops::Model::Project.new(body)
|
p = Devops::Model::Project.new(body)
|
||||||
halt_response("Project '#{p.id}' already exist") if Devops::Db.connector.is_project_exists?(p)
|
raise InvalidRecord.new("Project '#{p.id}' already exist") if Devops::Db.connector.is_project_exists?(p)
|
||||||
|
|
||||||
p.add_authorized_user [@request.env['REMOTE_USER']]
|
p.add_authorized_user [@request.env['REMOTE_USER']]
|
||||||
p.create
|
p.create
|
||||||
if p.multi?
|
if p.multi?
|
||||||
"Project '#{p.id}' with type 'multi' created"
|
"Project '#{p.id}' with type 'multi' created"
|
||||||
else
|
else
|
||||||
roles = create_roles p.id, p.deploy_envs, logger
|
roles = create_roles p.id, p.deploy_envs, DevopsLogger.logger
|
||||||
"Project '#{p.id}' created. " + create_roles_response(roles)
|
"Project '#{p.id}' created. " + create_roles_response(roles)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -54,7 +66,7 @@ module Devops
|
|||||||
project.id = id
|
project.id = id
|
||||||
old_project = Devops::Db.connector.project id
|
old_project = Devops::Db.connector.project id
|
||||||
Devops::Db.connector.project_update project
|
Devops::Db.connector.project_update project
|
||||||
roles = create_new_roles(old_project, project, logger)
|
roles = create_new_roles(old_project, project, DevopsLogger.logger)
|
||||||
create_roles_response(roles)
|
create_roles_response(roles)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -134,7 +146,7 @@ module Devops
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
jid = DeployWorker.perform_async(dir, s.to_hash, [], DevopsConfig.config)
|
jid = DeployWorker.perform_async(dir, s.to_hash, [], DevopsConfig.config)
|
||||||
#logger.info "Job '#{jid}' has been started"
|
#DevopsLogger.logger.info "Job '#{jid}' has been started"
|
||||||
uri.path = "#{DevopsConfig[:url_prefix]}/v2.0/report/" + jid
|
uri.path = "#{DevopsConfig[:url_prefix]}/v2.0/report/" + jid
|
||||||
files.push uri.to_s
|
files.push uri.to_s
|
||||||
end
|
end
|
||||||
|
|||||||
@ -80,13 +80,13 @@ module Devops
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_script file_name
|
def create_script file_name
|
||||||
file = File.join(settings.scripts_dir, file_name)
|
file = File.join(Devops::Api2.settings.scripts_dir, file_name)
|
||||||
raise RecordNotFound.new("File '#{file_name}' already exist") if File.exists?(file)
|
raise RecordNotFound.new("File '#{file_name}' already exist") if File.exists?(file)
|
||||||
File.open(file, "w") {|f| f.write(@request.body.read)}
|
File.open(file, "w") {|f| f.write(@request.body.read)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_script file_name
|
def delete_script file_name
|
||||||
file = File.join(settings.scripts_dir, file_nsme)
|
file = File.join(Devops::Api2.settings.scripts_dir, file_name)
|
||||||
raise RecordNotFound.new("File '#{file_name}' does not exist", 404) unless File.exists?(file)
|
raise RecordNotFound.new("File '#{file_name}' does not exist", 404) unless File.exists?(file)
|
||||||
FileUtils.rm(file)
|
FileUtils.rm(file)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,20 +18,22 @@ module Devops
|
|||||||
end
|
end
|
||||||
|
|
||||||
def change_user_privileges user_id, cmd, privileges
|
def change_user_privileges user_id, cmd, privileges
|
||||||
change_user(user_id) do
|
change_user(user_id) do |user|
|
||||||
user.grant(cmd, privileges)
|
user.grant(cmd, privileges)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_email user_id, val
|
def change_email options
|
||||||
change_user(user_id) do
|
user_id, email = options.values_at('user_id', 'email')
|
||||||
user.email = val
|
change_user(user_id) do |user|
|
||||||
|
user.email = email
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_password user_id, val
|
def change_password options
|
||||||
change_user(user_id) do
|
user_id, password = options.values_at('user_id', 'password')
|
||||||
user.password = val
|
change_user(user_id) do |user|
|
||||||
|
user.password = password
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -143,7 +143,7 @@ module Devops
|
|||||||
# 200 - Deleted
|
# 200 - Deleted
|
||||||
hash["DELETE"] = lambda {|image_id|
|
hash["DELETE"] = lambda {|image_id|
|
||||||
check_privileges("image", "w")
|
check_privileges("image", "w")
|
||||||
Devops::API2_0::Handler::Image.delete_image
|
Devops::API2_0::Handler::Image.new(request, params).delete_image(image_id)
|
||||||
create_response("Image '#{image_id}' has been removed")
|
create_response("Image '#{image_id}' has been removed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,22 +64,9 @@ module Devops
|
|||||||
# 200 - Deleted
|
# 200 - Deleted
|
||||||
app.delete_with_headers "/key/:key", :headers => [:accept] do
|
app.delete_with_headers "/key/:key", :headers => [:accept] do
|
||||||
check_privileges("key", "w")
|
check_privileges("key", "w")
|
||||||
servers = settings.mongo.servers_by_key params[:key]
|
|
||||||
unless servers.empty?
|
|
||||||
s_str = servers.map{|s| s.id}.join(", ")
|
|
||||||
raise DependencyError.new "Deleting is forbidden: Key is used in servers: #{s_str}"
|
|
||||||
end
|
|
||||||
|
|
||||||
k = settings.mongo.key params[:key]
|
|
||||||
begin
|
|
||||||
FileUtils.rm(k.path)
|
|
||||||
rescue
|
|
||||||
logger.error "Missing key file for #{params[:key]} - #{k.filename}"
|
|
||||||
end
|
|
||||||
r = settings.mongo.key_delete params[:key]
|
|
||||||
|
|
||||||
r = Devops::API2_0::Handler::Key.new.delete params[:key]
|
r = Devops::API2_0::Handler::Key.new.delete params[:key]
|
||||||
return [500, r["err"].inspect] unless r["err"].nil?
|
return [500, r["err"].inspect] if r["err"]
|
||||||
create_response("Key '#{params[:key]}' removed")
|
create_response("Key '#{params[:key]}' removed")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -100,7 +100,7 @@ module Devops
|
|||||||
check_privileges("project", "w")
|
check_privileges("project", "w")
|
||||||
body = create_object_from_json_body
|
body = create_object_from_json_body
|
||||||
r = Devops::API2_0::Handler::Project.new(request, params).update_project project, body
|
r = Devops::API2_0::Handler::Project.new(request, params).update_project project, body
|
||||||
info = "Project '#{project.id}' has been updated." + r
|
info = "Project '#{project}' has been updated." + r
|
||||||
create_response(info)
|
create_response(info)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,10 @@ module Devops
|
|||||||
# "stack_status": null,
|
# "stack_status": null,
|
||||||
# "id": "openstack_stack"
|
# "id": "openstack_stack"
|
||||||
# ]
|
# ]
|
||||||
app.get_with_headers "/project/:project/stacks", :headers => [:accept], &Devops::Version2_0::Handler::Project.get_project_stacks
|
app.get_with_headers "/project/:project/stacks", :headers => [:accept] do |project|
|
||||||
|
check_privileges("project", "r")
|
||||||
|
json Devops::API2_0::Handler::Project.new(request, params).project_stacks(project).map(&:to_hash)
|
||||||
|
end
|
||||||
|
|
||||||
# Create project and chef roles
|
# Create project and chef roles
|
||||||
#
|
#
|
||||||
@ -227,9 +230,13 @@ module Devops
|
|||||||
body = create_object_from_json_body
|
body = create_object_from_json_body
|
||||||
check_string(body["name"], "Parameter 'name' must be a not empty string")
|
check_string(body["name"], "Parameter 'name' must be a not empty string")
|
||||||
check_array(body["deploy_envs"], "Parameter 'deploy_envs' must be a not empty array of objects", Hash)
|
check_array(body["deploy_envs"], "Parameter 'deploy_envs' must be a not empty array of objects", Hash)
|
||||||
res = Devops::API2_0::Handler::Project.new(request, params).create_project body
|
begin
|
||||||
res = "Created. " + res
|
res = Devops::API2_0::Handler::Project.new(request, params).create_project body
|
||||||
create_response(res, nil, 201)
|
res = "Created. " + res
|
||||||
|
create_response(res, nil, 201)
|
||||||
|
rescue InvalidRecord => e
|
||||||
|
halt_response(e.message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
users_hash = {}
|
users_hash = {}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
module Devops
|
module Devops
|
||||||
module Version2_0
|
module API2_0
|
||||||
module Routes
|
module Routes
|
||||||
module ScriptRoutes
|
module ScriptRoutes
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ module Devops
|
|||||||
body = create_object_from_json_body
|
body = create_object_from_json_body
|
||||||
p = check_string(body[action], "Parameter '#{action}' must be a not empty string")
|
p = check_string(body[action], "Parameter '#{action}' must be a not empty string")
|
||||||
h = Devops::API2_0::Handler::User.new
|
h = Devops::API2_0::Handler::User.new
|
||||||
h.send("change_#{action}=", p)
|
h.send("change_#{action}", body.merge('user_id' => u))
|
||||||
create_response("Updated")
|
create_response("Updated")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ module Devops
|
|||||||
Devops::Api2.settings.mongo.create_root_user
|
Devops::Api2.settings.mongo.create_root_user
|
||||||
::Provider::ProviderFactory.init(config)
|
::Provider::ProviderFactory.init(config)
|
||||||
|
|
||||||
Stubber.stub_providers! if config[:stub_classes]
|
Stubber.stub_providers!(config[:stub_providers])
|
||||||
end
|
end
|
||||||
|
|
||||||
def routes
|
def routes
|
||||||
|
|||||||
@ -74,7 +74,10 @@ module Devops
|
|||||||
unless PRIVILEGES.include?(required_privelege)
|
unless PRIVILEGES.include?(required_privelege)
|
||||||
raise InvalidPrivileges.new("Access internal problem with privilege '#{required_privelege}'")
|
raise InvalidPrivileges.new("Access internal problem with privilege '#{required_privelege}'")
|
||||||
end
|
end
|
||||||
can?(cmd, required_privelege)
|
# can?(cmd, required_privelege)
|
||||||
|
unless can?(cmd, required_privelege)
|
||||||
|
raise InvalidPrivileges.new("Access denied for '#{id}'")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_root
|
def self.create_root
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
module Validators
|
module Validators
|
||||||
class Helpers; end
|
module Helpers; end
|
||||||
class DeployEnv; end
|
module DeployEnv; end
|
||||||
class Key; end
|
module Key; end
|
||||||
class Image; end
|
module Image; end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "db/validators/base"
|
require "db/validators/base"
|
||||||
|
|||||||
@ -5,10 +5,6 @@ Feature: Delete script
|
|||||||
When I send DELETE '/v2.0/script/cucumber_test_script' query with user without privileges
|
When I send DELETE '/v2.0/script/cucumber_test_script' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: Delete script without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/script/cucumber_test_script' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: Delete script with id 'cucumber_test_script'
|
Scenario: Delete script with id 'cucumber_test_script'
|
||||||
When I send DELETE '/v2.0/script/cucumber_test_script' query
|
When I send DELETE '/v2.0/script/cucumber_test_script' query
|
||||||
Then response should be '200'
|
Then response should be '200'
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: delete project
|
|||||||
When I send DELETE '/v2.0/project/test_openstack' query with user without privileges
|
When I send DELETE '/v2.0/project/test_openstack' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Delete openstack project without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/project/test_openstack' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Delete openstack project
|
Scenario: Delete openstack project
|
||||||
When I send DELETE '/v2.0/project/test_openstack' query
|
When I send DELETE '/v2.0/project/test_openstack' query
|
||||||
@ -29,11 +24,6 @@ Feature: delete project
|
|||||||
When I send DELETE '/v2.0/project/test_ec2' query with user without privileges
|
When I send DELETE '/v2.0/project/test_ec2' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@ec2
|
|
||||||
Scenario: Delete ec2 project without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/project/test_ec2' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@ec2
|
@ec2
|
||||||
Scenario: Delete ec2 project
|
Scenario: Delete ec2 project
|
||||||
When I send DELETE '/v2.0/project/test_ec2' query
|
When I send DELETE '/v2.0/project/test_ec2' query
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: delete image
|
|||||||
When I send DELETE '/v2.0/image/08093b30-8393-42c3-8fb3-c4df56deb967' query with user without privileges
|
When I send DELETE '/v2.0/image/08093b30-8393-42c3-8fb3-c4df56deb967' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Delete openstack image without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/image/08093b30-8393-42c3-8fb3-c4df56deb967' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Delete openstack image
|
Scenario: Delete openstack image
|
||||||
When I send DELETE '/v2.0/image/08093b30-8393-42c3-8fb3-c4df56deb967' query
|
When I send DELETE '/v2.0/image/08093b30-8393-42c3-8fb3-c4df56deb967' query
|
||||||
@ -29,11 +24,6 @@ Feature: delete image
|
|||||||
When I send DELETE '/v2.0/image/ami-63071b0a' query with user without privileges
|
When I send DELETE '/v2.0/image/ami-63071b0a' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@ec2
|
|
||||||
Scenario: Delete ec2 image without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/image/ami-63071b0a' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@ec2
|
@ec2
|
||||||
Scenario: Delete ec2 image
|
Scenario: Delete ec2 image
|
||||||
When I send DELETE '/v2.0/image/ami-63071b0a' query
|
When I send DELETE '/v2.0/image/ami-63071b0a' query
|
||||||
|
|||||||
@ -46,7 +46,11 @@ end
|
|||||||
|
|
||||||
When(/^I send POST '(.*)' query with JSON body with user without privileges$/) do |path, body|
|
When(/^I send POST '(.*)' query with JSON body with user without privileges$/) do |path, body|
|
||||||
JSON.parse(body) unless body.strip.empty?
|
JSON.parse(body) unless body.strip.empty?
|
||||||
res = post_without_privileges(path, body, DEFAULT_HEADERS)
|
post_without_privileges(path, body, DEFAULT_HEADERS)
|
||||||
|
end
|
||||||
|
|
||||||
|
When(/^I send POST '(.*)' query with user without privileges$/) do |path|
|
||||||
|
post_without_privileges(path, {}, DEFAULT_HEADERS)
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I send DELETE '(.*)' query$/) do |path|
|
When(/^I send DELETE '(.*)' query$/) do |path|
|
||||||
@ -102,12 +106,6 @@ When(/^I send PUT '(.*)' query with JSON body with header 'Accept' value '(.*)'$
|
|||||||
res = put_body(path, body, headers)
|
res = put_body(path, body, headers)
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I send PUT '(.*)' query with body without header 'Content-Type'$/) do |path, body|
|
|
||||||
headers = DEFAULT_HEADERS.clone
|
|
||||||
headers.delete("Content-Type")
|
|
||||||
res = put_body(path, body, headers)
|
|
||||||
end
|
|
||||||
|
|
||||||
When(/^I send PUT '(.*)' query with JSON body without header 'Content-Type'$/) do |path, body|
|
When(/^I send PUT '(.*)' query with JSON body without header 'Content-Type'$/) do |path, body|
|
||||||
JSON.parse(body) unless body.strip.empty?
|
JSON.parse(body) unless body.strip.empty?
|
||||||
headers = DEFAULT_HEADERS.clone
|
headers = DEFAULT_HEADERS.clone
|
||||||
|
|||||||
@ -30,10 +30,6 @@ Feature: list user
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Get list of all users without header 'Accept'
|
|
||||||
When I send GET '/v2.0/users' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: Get list of all users without privileges
|
Scenario: Get list of all users without privileges
|
||||||
When I send GET '/v2.0/users' query with user without privileges
|
When I send GET '/v2.0/users' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|||||||
@ -46,19 +46,10 @@ Feature: Flavors
|
|||||||
And the JSON response should be an array
|
And the JSON response should be an array
|
||||||
And response array should be empty
|
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
|
Scenario: Get flavors list of unknown provider
|
||||||
When I send GET '/v2.0/flavors/foo' query
|
When I send GET '/v2.0/flavors/foo' query
|
||||||
Then response should be '404'
|
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
|
Scenario: Get flavors list of unknown provider without privileges
|
||||||
When I send GET '/v2.0/flavors/foo' query with user without privileges
|
When I send GET '/v2.0/flavors/foo' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|||||||
@ -12,17 +12,6 @@ Feature: create user
|
|||||||
"""
|
"""
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: create user without header 'Accept'
|
|
||||||
When I send POST '/v2.0/user' query with JSON body without header 'Accept'
|
|
||||||
"""
|
|
||||||
{
|
|
||||||
"username": "<%= @config["user"]["name"] %>",
|
|
||||||
"email": "<%= @config["user"]["name"] %>@test.test",
|
|
||||||
"password": "<%= @config["user"]["name"] %>"
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: create user without header 'Content-Type'
|
Scenario: create user without header 'Content-Type'
|
||||||
When I send POST '/v2.0/user' query with JSON body without header 'Content-Type'
|
When I send POST '/v2.0/user' query with JSON body without header 'Content-Type'
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -19,10 +19,6 @@ Feature: Manage images
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Scenario: Get list of all images without header 'Accept'
|
|
||||||
When I send GET '/v2.0/images' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: Get list of all images without privileges
|
Scenario: Get list of all images without privileges
|
||||||
When I send GET '/v2.0/images' query with user without privileges
|
When I send GET '/v2.0/images' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
@ -57,11 +53,6 @@ Feature: Manage images
|
|||||||
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 array
|
And the JSON response should be an array
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Get list of openstack images (provider) without header 'Accept'
|
|
||||||
When I send GET '/v2.0/images/provider/openstack' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Get images list of openstack without privileges
|
Scenario: Get images list of openstack without privileges
|
||||||
When I send GET '/v2.0/images/provider/openstack' query with user without privileges
|
When I send GET '/v2.0/images/provider/openstack' query with user without privileges
|
||||||
@ -93,11 +84,6 @@ Feature: Manage images
|
|||||||
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 array
|
And the JSON response should be an array
|
||||||
|
|
||||||
@ec2
|
|
||||||
Scenario: Get list of ec2 images (provider) without header 'Accept'
|
|
||||||
When I send GET '/v2.0/images/provider/ec2' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@ec2
|
@ec2
|
||||||
Scenario: Get images list of ec2 without privileges
|
Scenario: Get images list of ec2 without privileges
|
||||||
When I send GET '/v2.0/images/provider/ec2' query with user without privileges
|
When I send GET '/v2.0/images/provider/ec2' query with user without privileges
|
||||||
@ -530,11 +516,6 @@ Feature: Manage images
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ec2
|
|
||||||
Scenario: Get info for single ec2 image without headers 'Accept'
|
|
||||||
When I send GET '/v2.0/image/<%= @config["ec2"]["image"] %>' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@ec2
|
@ec2
|
||||||
Scenario: Get ec2 image without privileges
|
Scenario: Get ec2 image without privileges
|
||||||
When I send GET '/v2.0/image/<%= @config["ec2"]["image"] %>' query with user without privileges
|
When I send GET '/v2.0/image/<%= @config["ec2"]["image"] %>' query with user without privileges
|
||||||
@ -557,11 +538,6 @@ Feature: Manage images
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Get info for single openstack image without headers 'Accept'
|
|
||||||
When I send GET '/v2.0/image/<%= @config["openstack"]["image"] %>' query without headers 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Get openstack image without privileges
|
Scenario: Get openstack image without privileges
|
||||||
When I send GET '/v2.0/image/<%= @config["openstack"]["image"] %>' query with user without privileges
|
When I send GET '/v2.0/image/<%= @config["openstack"]["image"] %>' query with user without privileges
|
||||||
|
|||||||
@ -5,13 +5,6 @@ Feature: Add new script
|
|||||||
When I send PUT '/v2.0/script/<%= @config["script"]["name"] %>' query with user without privileges
|
When I send PUT '/v2.0/script/<%= @config["script"]["name"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: Add new script without header 'Accept'
|
|
||||||
When I send PUT '/v2.0/script/<%= @config["script"]["name"] %>' query with body without header 'Accept'
|
|
||||||
"""
|
|
||||||
echo "<%= @config["script"]["name"] %>"
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: Add new script with id '<%= @config["script"]["name"] %>'
|
Scenario: Add new script with id '<%= @config["script"]["name"] %>'
|
||||||
When I send PUT '/v2.0/script/<%= @config["script"]["name"] %>' query with body
|
When I send PUT '/v2.0/script/<%= @config["script"]["name"] %>' query with body
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -21,15 +21,6 @@ Feature: change user privileges and password
|
|||||||
"""
|
"""
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: change user <%= k %> without header 'Accept'
|
|
||||||
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>/<%= k %>' query with JSON body without header 'Accept'
|
|
||||||
"""
|
|
||||||
{
|
|
||||||
"<%= k %>": "<%= val %>"
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: change user <%= k %> without header 'Content-Type'
|
Scenario: change user <%= k %> without header 'Content-Type'
|
||||||
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>/<%= k %>' query with JSON body without header 'Content-Type'
|
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>/<%= k %>' query with JSON body without header 'Content-Type'
|
||||||
"""
|
"""
|
||||||
@ -91,13 +82,6 @@ Feature: change user privileges and password
|
|||||||
"""
|
"""
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: change user privileges without header 'Accept'
|
|
||||||
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>' query with JSON body without header 'Accept'
|
|
||||||
"""
|
|
||||||
{}
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: change user privileges without header 'Content-Type'
|
Scenario: change user privileges without header 'Content-Type'
|
||||||
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>' query with JSON body without header 'Content-Type'
|
When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>' query with JSON body without header 'Content-Type'
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: Delete stack template
|
|||||||
When I send DELETE '/v2.0/stack_template/<%= openstack_template_id %>' query with user without privileges
|
When I send DELETE '/v2.0/stack_template/<%= openstack_template_id %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Delete openstack stack_template without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/stack_template/<%= openstack_template_id %>' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Delete openstack stack_template with id '<%= openstack_template_id %>'
|
Scenario: Delete openstack stack_template with id '<%= openstack_template_id %>'
|
||||||
When I send DELETE '/v2.0/stack_template/<%= openstack_template_id %>' query
|
When I send DELETE '/v2.0/stack_template/<%= openstack_template_id %>' query
|
||||||
|
|||||||
@ -5,10 +5,6 @@ Feature: Delete script
|
|||||||
When I send DELETE '/v2.0/script/<%= @config["script"]["name"] %>' query with user without privileges
|
When I send DELETE '/v2.0/script/<%= @config["script"]["name"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: Delete script without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/script/<%= @config["script"]["name"] %>' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: Delete script with id '<%= @config["script"]["name"] %>'
|
Scenario: Delete script with id '<%= @config["script"]["name"] %>'
|
||||||
When I send DELETE '/v2.0/script/<%= @config["script"]["name"] %>' query
|
When I send DELETE '/v2.0/script/<%= @config["script"]["name"] %>' query
|
||||||
Then response should be '200'
|
Then response should be '200'
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: Delete stack
|
|||||||
When I send DELETE '/v2.0/stack/<%= openstack_stack_id %>' query with user without privileges
|
When I send DELETE '/v2.0/stack/<%= openstack_stack_id %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Delete openstack stack without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/stack/<%= openstack_stack_id %>' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Delete stack with id '<%= openstack_stack_id %>'
|
Scenario: Delete stack with id '<%= openstack_stack_id %>'
|
||||||
When I send DELETE '/v2.0/stack/<%= openstack_stack_id %>' query
|
When I send DELETE '/v2.0/stack/<%= openstack_stack_id %>' query
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: delete project
|
|||||||
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query 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'
|
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
|
@openstack
|
||||||
Scenario: Delete openstack project
|
Scenario: Delete openstack project
|
||||||
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query
|
When I send DELETE '/v2.0/project/<%= @config["openstack"]["project"]["name"] %>' query
|
||||||
@ -29,11 +24,6 @@ Feature: delete project
|
|||||||
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query 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'
|
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
|
@ec2
|
||||||
Scenario: Delete ec2 project
|
Scenario: Delete ec2 project
|
||||||
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query
|
When I send DELETE '/v2.0/project/<%= @config["ec2"]["project"]["name"] %>' query
|
||||||
@ -53,11 +43,6 @@ Feature: delete project
|
|||||||
When I send DELETE '/v2.0/project/<%= @config["static"]["project"]["name"] %>' query with user without privileges
|
When I send DELETE '/v2.0/project/<%= @config["static"]["project"]["name"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@static
|
|
||||||
Scenario: Delete static project without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/project/<%= @config["static"]["project"]["name"] %>' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@static
|
@static
|
||||||
Scenario: Delete static project
|
Scenario: Delete static project
|
||||||
When I send DELETE '/v2.0/project/<%= @config["static"]["project"]["name"] %>' query
|
When I send DELETE '/v2.0/project/<%= @config["static"]["project"]["name"] %>' query
|
||||||
|
|||||||
@ -6,11 +6,6 @@ Feature: delete image
|
|||||||
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query with user without privileges
|
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
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
|
@openstack
|
||||||
Scenario: Delete openstack image
|
Scenario: Delete openstack image
|
||||||
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query
|
When I send DELETE '/v2.0/image/<%= @config["openstack"]["image"] %>' query
|
||||||
@ -29,11 +24,6 @@ Feature: delete image
|
|||||||
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query with user without privileges
|
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
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
|
@ec2
|
||||||
Scenario: Delete ec2 image
|
Scenario: Delete ec2 image
|
||||||
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query
|
When I send DELETE '/v2.0/image/<%= @config["ec2"]["image"] %>' query
|
||||||
|
|||||||
@ -5,10 +5,6 @@ Feature: delete user
|
|||||||
When I send DELETE '/v2.0/user/<%= @config["user"]["name"] %>' query with user without privileges
|
When I send DELETE '/v2.0/user/<%= @config["user"]["name"] %>' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
Scenario: delete user without header 'Accept'
|
|
||||||
When I send DELETE '/v2.0/user/<%= @config["user"]["name"] %>' query without header 'Accept'
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
Scenario: delete unknown user
|
Scenario: delete unknown user
|
||||||
When I send DELETE '/v2.0/user/unknown' query
|
When I send DELETE '/v2.0/user/unknown' query
|
||||||
Then response should be '404'
|
Then response should be '404'
|
||||||
|
|||||||
@ -6,16 +6,6 @@ Feature: Filters
|
|||||||
When I send DELETE '/v2.0/filter/openstack/image' query with user without privileges
|
When I send DELETE '/v2.0/filter/openstack/image' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@openstack
|
|
||||||
Scenario: Delete openstack image filter with header 'Accept' value 'text/*'
|
|
||||||
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body with header 'Accept' value 'text/*'
|
|
||||||
"""
|
|
||||||
[
|
|
||||||
"<%= @config["openstack"]["image"] %>"
|
|
||||||
]
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@openstack
|
@openstack
|
||||||
Scenario: Delete openstack image filter without header 'Content-Type'
|
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'
|
When I send DELETE '/v2.0/filter/openstack/image' query with JSON body without header 'Content-Type'
|
||||||
@ -91,16 +81,6 @@ Feature: Filters
|
|||||||
When I send DELETE '/v2.0/filter/ec2/image' query with user without privileges
|
When I send DELETE '/v2.0/filter/ec2/image' query with user without privileges
|
||||||
Then response should be '401'
|
Then response should be '401'
|
||||||
|
|
||||||
@ec2
|
|
||||||
Scenario: Delete ec2 image filter with header 'Accept' value 'text/*'
|
|
||||||
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body with header 'Accept' value 'text/*'
|
|
||||||
"""
|
|
||||||
[
|
|
||||||
"<%= @config["ec2"]["image"] %>"
|
|
||||||
]
|
|
||||||
"""
|
|
||||||
Then response should be '406'
|
|
||||||
|
|
||||||
@ec2
|
@ec2
|
||||||
Scenario: Delete ec2 image filter without header 'Content-Type'
|
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'
|
When I send DELETE '/v2.0/filter/ec2/image' query with JSON body without header 'Content-Type'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user