more tests for scripts

This commit is contained in:
Tim Lianov 2014-07-08 14:21:45 +04:00
parent 76f9e73c94
commit 4620483cca
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,20 @@
@script
Feature: Add new script
Scenario: Add new script with user without privileges
When I send PUT '/v2.0/script/cucumber_test_script' query with user without privileges
Then response should be '401'
Scenario: Add new script without header 'Accept'
When I send PUT '/v2.0/script/cucumber_test_script' query with body without header 'Accept'
"""
echo "cucumber test script"
"""
Then response should be '406'
Scenario: Add new script with id 'cucumber_test_script'
When I send PUT '/v2.0/script/cucumber_test_script' query with body
"""
echo "cucumber test script"
"""
Then response should be '201'

View File

@ -0,0 +1,13 @@
@script
Feature: Run script
Scenario: Run script
When I send POST '/v2.0/script/run/cucumber_test_script' query with JSON body
"""
{
"nodes": [
"devops-webapp_dev"
]
}
"""
Then response should be '200'

View File

@ -0,0 +1,16 @@
@script
Feature: Delete script
Scenario: Delete script with user without privileges
When I send DELETE '/v2.0/script/cucumber_test_script' query with user without privileges
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'
When I send DELETE '/v2.0/script/cucumber_test_script' query
Then response should be '200'
And the Content-Type header should include 'application/json'
And the JSON response should be an object

View File

@ -58,6 +58,10 @@ When(/^I send DELETE '(.*)' query with user without privileges$/) do |path|
delete_without_privileges(path, {}, DEFAULT_HEADERS)
end
When(/^I send PUT '(.*)' query with body$/) do |path, body|
res = put_body(path, body, DEFAULT_HEADERS)
end
When(/^I send PUT '(.*)' query with JSON body$/) do |path, body|
res = put_body(path, body, DEFAULT_HEADERS)
end
@ -66,6 +70,11 @@ When(/^I send PUT '(.*)' query with user without privileges$/) do |path|
put_without_privileges(path, {}, DEFAULT_HEADERS)
end
When(/^I send PUT '(.*)' query with body without header '(.*)'$/) do |path, hs, body|
headers = DEFAULT_HEADERS.select{|h, v| h != hs}
res = put_body(path, body, headers)
end
When(/^I send PUT '(.*)' query with JSON body without header '(.*)'$/) do |path, hs, body|
headers = DEFAULT_HEADERS.select{|h, v| h != hs}
res = put_body(path, body, headers)