@user @delete @role <%= @formatter.get_fixture('providers/all').map{|provider| "@#{provider}"}.join(" ") %>
Feature: delete user and role

  <% superuser_hash = @formatter.get_fixture('user/superuser') %>
  <% username = superuser_hash["id"] %>
  <% user_role = superuser_hash["roles"][0] %>
  Scenario: delete user with user without privileges
    When I send DELETE '/v3/user/<%= username %>' query with user without privileges
    Then response should be '401'

  Scenario: delete unknown user
    When I send DELETE '/v3/user/unknown' query
    Then response should be '404'

  Scenario: delete user with header 'Accept' value is not 'application/json'
    When I send DELETE '/v3/user/<%= username %>' query with header 'Accept' value 'application/xml'
    Then response should be '406'

  Scenario: delete role with user without privileges
    When I send DELETE '/v3/security/role/<%= user_role %>' query with user without privileges
    Then response should be '401'

  Scenario: delete unknown role
    When I send DELETE '/v3/security/role/unknown' query
    Then response should be '404'

  Scenario: delete user with header 'Accept' value is not 'application/json'
    When I send DELETE '/v3/security/role/<%= user_role %>' query with header 'Accept' value 'application/xml'
    Then response should be '406'

  <% tinyuser_hash = @formatter.get_fixture('user/tinyuser') %>
  <% tinyusername = tinyuser_hash["id"] %>
  Scenario: delete tinyuser
    When I send DELETE '/v3/user/<%= tinyusername %>' query
    Then response should be '200'
    And the Content-Type header should include 'application/json'
    And store value '<%= @config['username'] %>' in variable 'username'
    And store value '<%= @config['password'] %>' in variable 'password'

  Scenario: delete tinyuser
    When I send DELETE '/v3/user/<%= tinyusername %>' query
    Then response should be '404'
    And the Content-Type header should include 'application/json'

  Scenario: delete superuser
    When I send DELETE '/v3/user/<%= username %>' query
    Then response should be '200'
    And the Content-Type header should include 'application/json'

  Scenario: delete superuser role
    When I send DELETE '/v3/security/role/<%= user_role %>' query
    Then response should be '200'
    And the Content-Type header should include 'application/json'

