From 9820ef415f68bb0b0663485843453214fc954da2 Mon Sep 17 00:00:00 2001 From: Anton Chuchkalov Date: Wed, 8 Jul 2015 16:56:24 +0400 Subject: [PATCH] add tests to stack template presets --- .../routes/v2.0/stack_template_presets.rb | 6 ++-- devops-service/tests/generate_tests.rb | 1 + .../00_list/stack_template_preset.feature.erb | 28 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 devops-service/tests/templates/api_v2/00_list/stack_template_preset.feature.erb diff --git a/devops-service/routes/v2.0/stack_template_presets.rb b/devops-service/routes/v2.0/stack_template_presets.rb index 88aeede..8cdb70d 100644 --- a/devops-service/routes/v2.0/stack_template_presets.rb +++ b/devops-service/routes/v2.0/stack_template_presets.rb @@ -24,8 +24,8 @@ module Devops # - headers : # - Accept: application/json # - # * *Returns* : array of strings - # [ 'postgres_cluster' ] + # * *Returns* : hash + # {id: 'preset id', template_preset_body: 'long body'} # app.get_with_headers "/stack_template_presets/:id", :headers => [:accept], &Devops::Version2_0::Handler::StackTemplatePreset.get_preset @@ -41,6 +41,8 @@ module Devops # - stack_template_id: id of stack template to create # - template_attrs: hash with template attributes # + # TODO: not stack template, but stack itself + # # * *Returns* : created stack template model # { # id: 'template id', diff --git a/devops-service/tests/generate_tests.rb b/devops-service/tests/generate_tests.rb index e705963..91cb57a 100755 --- a/devops-service/tests/generate_tests.rb +++ b/devops-service/tests/generate_tests.rb @@ -72,6 +72,7 @@ templates = { #list "templates/api_v2/00_list/flavor.feature.erb" => "features/api_v2/00_list/flavor.feature", + "templates/api_v2/00_list/stack_template_preset.feature.erb" => "features/api_v2/00_list/stack_template_preset.feature", "templates/api_v2/00_list/10_user.feature.erb" => "features/api_v2/00_list/10_user.feature", #create diff --git a/devops-service/tests/templates/api_v2/00_list/stack_template_preset.feature.erb b/devops-service/tests/templates/api_v2/00_list/stack_template_preset.feature.erb new file mode 100644 index 0000000..823f006 --- /dev/null +++ b/devops-service/tests/templates/api_v2/00_list/stack_template_preset.feature.erb @@ -0,0 +1,28 @@ +@stack_template_preset +Feature: stack template preset list + + Scenario: Get list of all stack template presets + When I send GET '/v2.0/stack_template_presets' query + Then response should be '200' + And the Content-Type header should include 'application/json' + And the JSON response should be an array + And response array should contains elements like: + """ + [ + { + "id": "test", + "template_preset_body": "long body" + } + ] + """ + + Scenario: Get information about particular stack template preset + When I send GET '/v2.0/stack_template_presets/postgres_cluster' query + Then response should be '200' + And the Content-Type header should include 'application/json' + And response should be JSON object like: + """ + { + "id": "postgres_cluster", "template_preset_body": "long body" + } + """ \ No newline at end of file