diff --git a/devops-service/features/api_v2/10_create/20_script.feature b/devops-service/features/api_v2/10_create/20_script.feature new file mode 100644 index 0000000..2b4c231 --- /dev/null +++ b/devops-service/features/api_v2/10_create/20_script.feature @@ -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' diff --git a/devops-service/features/api_v2/30_execute/20_script.feature b/devops-service/features/api_v2/30_execute/20_script.feature new file mode 100644 index 0000000..2d5c409 --- /dev/null +++ b/devops-service/features/api_v2/30_execute/20_script.feature @@ -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' diff --git a/devops-service/features/api_v2/90_delete/10_script.feature b/devops-service/features/api_v2/90_delete/10_script.feature new file mode 100644 index 0000000..5ce11ae --- /dev/null +++ b/devops-service/features/api_v2/90_delete/10_script.feature @@ -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 diff --git a/devops-service/features/step_definitions/http_queries_steps.rb b/devops-service/features/step_definitions/http_queries_steps.rb index 4f5bc7e..146f3c9 100644 --- a/devops-service/features/step_definitions/http_queries_steps.rb +++ b/devops-service/features/step_definitions/http_queries_steps.rb @@ -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)