fluke/devops-service/tests/templates/api_v2/10_create/00_key.feature.erb
amartynov b70165c3b4 \#780: done
fixed role name

new field validators

without validate fields types

fixed error with user parser

todo: project tests

returned  some tests, users fixed

some more tests: filters

images tests

network tests

keys tests

test generator

fixed run_list validator
2015-10-20 13:36:44 +03:00

45 lines
1.5 KiB
Plaintext

<% providers = @formatter.get_fixture('providers/all').map{|p| "@#{p}"} %>
@key <%= providers.join(" ") %>
Feature: Add new key
<% new_key = @formatter.get_fixture('key/new') %>
<% new_key.keys.each do |key| %>
<% [[], {}, nil].each do |value| %>
Scenario: Add new key with <%= key %> value <%= value %>
When I send POST '/v2.0/key' query with JSON body
"""
<%= @formatter.json('key/new', {spaces: 4, value: {key => value}}) %>
"""
Then response should be '400'
And response error should be "Parameter '<%= key %>' should be a not empty string"
Scenario: Add new key without <%= key %>
When I send POST '/v2.0/key' query with JSON body
"""
<%= @formatter.json('key/new', {spaces: 4, without_field: key}) %>
"""
Then response should be '400'
And response error should be "Parameter '<%= key %>' should be a not empty string"
<% end #value %>
<% end %>
Scenario: Add new key with header 'Accept' value is not 'application/json'
When I send POST '/v2.0/key' query with JSON body with header 'Accept' value 'application/xml'
"""
<%= @formatter.json('key/new') %>
"""
Then response should be '406'
Scenario: Add new key without privileges
When I send POST '/v2.0/key' query with user without privileges
Then response should be '401'
Scenario: Add new key
When I send POST '/v2.0/key' query with JSON body
"""
<%= @formatter.json('key/new') %>
"""
Then response should be '201'