2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@user
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Feature: change user privileges and password
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  <% user_hash = @formatter.get_fixture('user/create') %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% username = user_hash["username"] %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% update_user_hash = @formatter.get_fixture('user/update') %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% update_user_hash.keys.each do |k| %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %> with user without privileges
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body with user without privileges
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      "<%= k %>": "<%= update_user_hash[k] %>"
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '401'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change root <%= k %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/root/<%= k %>' query with JSON body
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      "<%= k %>": "<%= update_user_hash[k] %>"
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '401'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %> without header 'Content-Type'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body without header 'Content-Type'
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      "<%= k %>": "<%= update_user_hash[k] %>"
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '415'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %>, invalid body: empty
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  <% ["", "[]"].each do |body| %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %>, invalid body: body is a '<%= body %>'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <%= body %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% elements = ["{}", "[]", "null" ] %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% elements.each do |value| %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %>, invalid body: <%= k %> is a '<%= value %>'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      "<%= k %>": <%= value %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user <%= k %>
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>/<%= k %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      "<%= k %>": "<%= update_user_hash[k] %>"
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '200'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    And the Content-Type header should include 'application/json'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges with user without privileges
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body with user without privileges
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges', {spaces: 4}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '401'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change root privileges
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/root' query with JSON body
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges', {spaces: 4}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '401'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges without header 'Content-Type'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body without header 'Content-Type'
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges', {spaces: 4}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '415'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges with header 'Accept' value is not application/json
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body with header 'Accept' value 'application/xml'
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges', {spaces: 4}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    Then response should be '406'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% elements = ["{}", "[]" ] %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% elements.each do |value| %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges, invalid body: cmd is a '<%= value %>'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => value, "privileges" => "r"}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges, invalid body: privileges is a '<%= value %>'
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => "foo", "privileges" => value}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: foo - r
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => "foo", "privileges" => "r"}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% %w{foo, rr, rwwww, rwxxx, rwf}.each do |priv| %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: all - <%= priv %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= @config["user"]["name"] %>' query with JSON body
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => "all", "privileges" => priv}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  <% privs = @formatter.get_fixture('user/privileges_values') %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% (@formatter.get_fixture('user/privileges').keys.map(&:to_s) << "all").each do |cmd| %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <% privs.each do |priv| %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: <%= cmd %> - <%= priv %>
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => cmd, "privileges" => priv}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '200'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: <%= cmd %> - without privileges
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => cmd}, without_field: "privileges"}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '200'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: <%= cmd %> - '  '
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <%= @formatter.json('user/privileges_update', {spaces: 4, value: {"cmd" => cmd, "privileges" => "  "}}) %>
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '400'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <% end %>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Scenario: change user privileges: set default privileges
							 | 
						
					
						
							
								
									
										
										
										
											2015-10-06 13:50:26 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    When I send PUT '/v2.0/user/<%= username %>' query with JSON body
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-16 13:32:59 +04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Then response should be '200'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 |