443 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			443 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|  | @image @project | ||
|  | Feature: Update images | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with ec2 provider | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid provider | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "foo", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid provider - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": ["foo"], | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid provider - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": {}, | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid name - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": {}, | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid name - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": [], | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid remote_user - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": {}, | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid remote_user - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": [], | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid bootstrap_template - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": [], | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid bootstrap_template - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": {}, | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid bootstrap_template - unknown | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "unknown", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid id - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": [] | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image with invalid id - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": {} | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ | ||
|  | 
 | ||
|  |   @openstack | ||
|  |   Scenario: Update openstack image | ||
|  |     When I send PUT '/v2.0/image/<%= @config["openstack"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "freebsd-10.0", | ||
|  |       "remote_user": "root", | ||
|  |       "bootstrap_template": "chef_freebsd", | ||
|  |       "id": "<%= @config["openstack"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with openstack provider | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "openstack", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid provider | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "foo", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid provider - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": ["foo"], | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid provider - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": {}, | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid name - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": {}, | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid name - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": [], | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid remote_user - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": {}, | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid remote_user - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": [], | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid bootstrap_template - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": [], | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid bootstrap_template - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": {}, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid bootstrap_template - unknown | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": "unknown", | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '400' | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid id - array | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": [] | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image with invalid id - hash | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": {} | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ | ||
|  | 
 | ||
|  |   @ec2 | ||
|  |   Scenario: Update ec2 image | ||
|  |     When I send PUT '/v2.0/image/<%= @config["ec2"]["image"] %>' query with JSON body | ||
|  |     """ | ||
|  |     { | ||
|  |       "provider": "ec2", | ||
|  |       "name": "test-ec2", | ||
|  |       "remote_user": "ec2-user", | ||
|  |       "bootstrap_template": null, | ||
|  |       "id": "<%= @config["ec2"]["image"] %>" | ||
|  |     } | ||
|  |     """ | ||
|  |     Then response should be '200' | ||
|  |     And the Content-Type header should include 'application/json' | ||
|  |     And the JSON response should be an object | ||
|  |     And response should be JSON object like: | ||
|  |     """ | ||
|  |     { | ||
|  |       "message" : "Image '<%= @config["openstack"]["image"] %>' has been updated" | ||
|  |     } | ||
|  |     """ |