@image @project @create
Feature: Manage images

  <% providers = @formatter.get_fixture('providers/without_static') %>
  <% providers.each do |provider| %>
    <% other_providers = providers.clone - [provider] %>
    <% other_providers.each do |oprovider| %>
  @<%= provider %>
  Scenario: Create <%= provider %> image with '<%= oprovider %>' provider (invalid image id for provider)
    When I send POST '/v3/image' query with JSON body
    """
    <%= @formatter.json(provider + '/image', {value: {"provider" => oprovider}}) %>
    """
    Then response should be '422'

    <% end #other providers%>

  <% image = @formatter.get_fixture(provider + '/image') %>
  <% generate_create_path_scenarios "Create #{provider} image", "/v3/image", image, @formatter.get_fixture(provider + '/image_mandatory_fields'), provider do %>
    And the JSON response should be an object
  <% end %>

  <% generate_get_path_scenarios_with_provider "Check new #{provider} image", "/v3/image/#{image["id"]}", provider do %>
    And the JSON response should be an object
    And response should be JSON object like:
    """
    <%= @formatter.json(provider + '/image') %>
    """
  <% end %>

  <% end %>

