diff --git a/lib/aviator/openstack/compute/v2/public/list_flavors.rb b/lib/aviator/openstack/compute/v2/public/list_flavors.rb new file mode 100644 index 0000000..bb77930 --- /dev/null +++ b/lib/aviator/openstack/compute/v2/public/list_flavors.rb @@ -0,0 +1,55 @@ +module Aviator + + define_request :list_flavors do + + meta :provider, :openstack + meta :service, :compute + meta :api_version, :v2 + meta :endpoint_type, :public + + link 'documentation', + 'http://docs.openstack.org/api/openstack-compute/2/content/List_Flavors-d1e4188.html' + + param :details, required: false + param :minDisk, required: false + param :minRam, required: false + param :marker, required: false + param :limit, required: false + + + def headers + h = {} + + unless self.anonymous? + h['X-Auth-Token'] = session_data[:access][:token][:id] + end + + h + end + + + def http_method + :get + end + + + def url + service_spec = session_data[:access][:serviceCatalog].find{|s| s[:type] == service.to_s } + + str = "#{ service_spec[:endpoints][0][:publicURL] }/flavors" + str += "/detail" if params[:details] + + filters = [] + + (optional_params + required_params - [:details]).each do |param_name| + filters << "#{ param_name }=#{ params[param_name] }" if params[param_name] + end + + str += "?#{ filters.join('&') }" unless filters.empty? + + str + end + + end + +end diff --git a/test/aviator/openstack/compute/v2/public/list_flavors_test.rb b/test/aviator/openstack/compute/v2/public/list_flavors_test.rb new file mode 100644 index 0000000..ffcb94e --- /dev/null +++ b/test/aviator/openstack/compute/v2/public/list_flavors_test.rb @@ -0,0 +1,160 @@ +require 'test_helper' + +class Aviator::Test + + describe 'aviator/openstack/compute/v2/public/list_flavors' do + + def create_request(session_data = get_session_data) + klass.new(session_data) + end + + + def session + unless @session + @session = Aviator::Session.new( + config_file: Environment.path, + environment: 'openstack_member' + ) + @session.authenticate + end + + @session + end + + + def get_session_data + session.send :auth_info + end + + + def helper + Aviator::Test::RequestHelper + end + + + def klass + @klass ||= helper.load_request('openstack', 'compute', 'v2', 'public', 'list_flavors.rb') + end + + + validate_attr :anonymous? do + klass.anonymous?.must_equal false + end + + + validate_attr :api_version do + klass.api_version.must_equal :v2 + end + + + validate_attr :body do + klass.body?.must_equal false + create_request.body?.must_equal false + end + + + validate_attr :endpoint_type do + klass.endpoint_type.must_equal :public + end + + + validate_attr :headers do + headers = { 'X-Auth-Token' => get_session_data[:access][:token][:id] } + + request = create_request(get_session_data) + + request.headers.must_equal headers + end + + + validate_attr :http_method do + create_request.http_method.must_equal :get + end + + + validate_attr :optional_params do + klass.optional_params.must_equal [ + :details, + :minDisk, + :minRam, + :marker, + :limit + ] + end + + + validate_attr :required_params do + klass.required_params.must_equal [] + end + + + validate_attr :url do + service_spec = get_session_data[:access][:serviceCatalog].find{|s| s[:type] == 'compute' } + url = "#{ service_spec[:endpoints][0][:publicURL] }/flavors" + + params = [ + [ :details, true ], + [ :minDisk, 2 ], + [ :minRam, 'cirros-0.3.1-x86_64-uec-ramdisk' ], + [ :marker, '123456' ], + [ :limit, 10 ] + ] + + url += "/detail" if params.find{|pair| pair[0] == :details && pair[1] == true } + + filters = [] + + params.select{|pair| pair[0]!=:details }.each{ |pair| filters << "#{ pair[0] }=#{ pair[1] }" } + + url += "?#{ filters.join('&') }" unless filters.empty? + + request = klass.new(get_session_data) do |p| + params.each { |pair| p[pair[0]] = pair[1] } + end + + request.url.must_equal url + end + + + validate_response 'no parameters are provided' do + response = session.compute_service.request :list_flavors + + response.status.must_equal 200 + response.body.wont_be_nil + response.headers.wont_be_nil + end + + + validate_response 'the details filter is provided' do + response = session.compute_service.request :list_flavors do |params| + params[:details] = true + end + + response.status.must_equal 200 + response.body.wont_be_nil + response.body[:flavors].length.wont_equal 0 + response.headers.wont_be_nil + end + + + validate_response 'the minDisk filter is provided' do + response = session.compute_service.request :list_flavors do |params| + params[:details] = true + end + + max_disk_size = response.body[:flavors].max{|a,b| a[:disk] <=> b[:disk] }[:disk] + total_entries = response.body[:flavors].count{|flv| flv[:disk] == max_disk_size } + + response = session.compute_service.request :list_flavors do |params| + params[:minDisk] = max_disk_size + end + + response.status.must_equal 200 + response.body.wont_be_nil + response.body[:flavors].length.must_equal total_entries + response.headers.wont_be_nil + end + + end + +end diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_no_parameters_are_provided.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_no_parameters_are_provided.yml new file mode 100644 index 0000000..af4d773 --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_no_parameters_are_provided.yml @@ -0,0 +1,104 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:26 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:26.381243", + "expires": "2013-09-05T09:51:26Z", "id": "261ec384addb47f588c8d6db29a1e353", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:28 GMT +- request: + method: get + uri: :8774/v2/d770443fc60a410c843dc12b98ac8135/flavors + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + X-Auth-Token: + - 261ec384addb47f588c8d6db29a1e353 + response: + status: + code: 200 + message: + headers: + x-compute-request-id: + - req-201e6de8-4def-4f42-beb6-e30088b76036 + content-type: + - application/json + content-length: + - '1075' + date: + - Thu, 05 Sep 2013 03:51:28 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"flavors": [{"id": "2", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "bookmark"}], "name": "m1.small"}, {"id": "3", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "bookmark"}], "name": "m1.medium"}, {"id": "4", "links": [{"href": + ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "bookmark"}], "name": "m1.large"}, {"id": "5", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "bookmark"}], "name": "m1.xlarge"}]}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:30 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_details_filter_is_provided.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_details_filter_is_provided.yml new file mode 100644 index 0000000..d28ae4a --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_details_filter_is_provided.yml @@ -0,0 +1,111 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:29 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:29.355284", + "expires": "2013-09-05T09:51:29Z", "id": "146ea14f2d324706bec7410b1fab8376", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:31 GMT +- request: + method: get + uri: :8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/detail + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + X-Auth-Token: + - 146ea14f2d324706bec7410b1fab8376 + response: + status: + code: 200 + message: + headers: + x-compute-request-id: + - req-fac295e5-e209-4c15-b24f-b5022ee2b2d3 + content-type: + - application/json + content-length: + - '1772' + date: + - Thu, 05 Sep 2013 03:51:30 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"flavors": [{"name": "m1.small", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false, "vcpus": + 1, "swap": 1024, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 10, "id": "2"}, {"name": "m1.medium", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "bookmark"}], "ram": 4096, "OS-FLV-DISABLED:disabled": false, "vcpus": + 2, "swap": 1024, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 20, "id": "3"}, {"name": "m1.large", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "bookmark"}], "ram": 8192, "OS-FLV-DISABLED:disabled": false, "vcpus": + 4, "swap": 2048, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 30, "id": "4"}, {"name": "m1.xlarge", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "bookmark"}], "ram": 16384, "OS-FLV-DISABLED:disabled": false, "vcpus": + 8, "swap": 2048, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 40, "id": "5"}]}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:32 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_minDisk_filter_is_provided.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_minDisk_filter_is_provided.yml new file mode 100644 index 0000000..aae9139 --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/leads_to_a_valid_response_when_the_minDisk_filter_is_provided.yml @@ -0,0 +1,146 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:36 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:36.043953", + "expires": "2013-09-05T09:51:35Z", "id": "67ca64a3ee39430987008b56b0fbcc3d", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:37 GMT +- request: + method: get + uri: :8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/detail + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + X-Auth-Token: + - 67ca64a3ee39430987008b56b0fbcc3d + response: + status: + code: 200 + message: + headers: + x-compute-request-id: + - req-6d18b8ff-652f-4a44-ab7c-24b82346c1b6 + content-type: + - application/json + content-length: + - '1772' + date: + - Thu, 05 Sep 2013 03:51:37 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"flavors": [{"name": "m1.small", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/2", + "rel": "bookmark"}], "ram": 2048, "OS-FLV-DISABLED:disabled": false, "vcpus": + 1, "swap": 1024, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 10, "id": "2"}, {"name": "m1.medium", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/3", + "rel": "bookmark"}], "ram": 4096, "OS-FLV-DISABLED:disabled": false, "vcpus": + 2, "swap": 1024, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 20, "id": "3"}, {"name": "m1.large", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/4", + "rel": "bookmark"}], "ram": 8192, "OS-FLV-DISABLED:disabled": false, "vcpus": + 4, "swap": 2048, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 30, "id": "4"}, {"name": "m1.xlarge", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "bookmark"}], "ram": 16384, "OS-FLV-DISABLED:disabled": false, "vcpus": + 8, "swap": 2048, "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": + 0, "disk": 40, "id": "5"}]}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:38 GMT +- request: + method: get + uri: :8774/v2/d770443fc60a410c843dc12b98ac8135/flavors?minDisk=40 + body: + encoding: US-ASCII + string: '' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + X-Auth-Token: + - 67ca64a3ee39430987008b56b0fbcc3d + response: + status: + code: 200 + message: + headers: + x-compute-request-id: + - req-206591b0-d67d-4b70-a807-81d08219a09d + content-type: + - application/json + content-length: + - '279' + date: + - Thu, 05 Sep 2013 03:51:38 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"flavors": [{"id": "5", "links": [{"href": ":8774/v2/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "self"}, {"href": ":8774/d770443fc60a410c843dc12b98ac8135/flavors/5", + "rel": "bookmark"}], "name": "m1.xlarge"}]}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:39 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_body_.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_body_.yml new file mode 100644 index 0000000..da1512e --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_body_.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:33 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:33.761469", + "expires": "2013-09-05T09:51:33Z", "id": "6ac7ecaae2af40a7b00aa6658740a3bc", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:35 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_headers_.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_headers_.yml new file mode 100644 index 0000000..0c26009 --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_headers_.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:41 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:41.418437", + "expires": "2013-09-05T09:51:41Z", "id": "21aa5c13f2954af28c664e649cbdbb4b", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:43 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_http_method_.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_http_method_.yml new file mode 100644 index 0000000..b1bb6b6 --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_http_method_.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:32 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:32.271221", + "expires": "2013-09-05T09:51:32Z", "id": "cc1cdc7a25cb42d1b54ad593998abfba", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:34 GMT +recorded_with: VCR 2.5.0 diff --git a/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_url_.yml b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_url_.yml new file mode 100644 index 0000000..af4e965 --- /dev/null +++ b/test/cassettes/openstack/compute/v2/public/list_flavors/returns_the_correct_value_for_url_.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: :5000/v2.0/tokens + body: + encoding: UTF-8 + string: ! '{"auth":{"passwordCredentials":{"username":"","password":""},"tenantName":""}}' + headers: + Content-Type: + - application/json + User-Agent: + - Faraday v0.8.8 + response: + status: + code: 200 + message: + headers: + vary: + - X-Auth-Token + content-type: + - application/json + content-length: + - '2654' + date: + - Thu, 05 Sep 2013 03:51:39 GMT + connection: + - close + body: + encoding: US-ASCII + string: ! '{"access": {"token": {"issued_at": "2013-09-05T03:51:39.770876", + "expires": "2013-09-05T09:51:39Z", "id": "0c1511af4f3e41e48349944d181e4c33", + "tenant": {"description": "Used for Aviator testing/development ", "enabled": + true, "id": "d770443fc60a410c843dc12b98ac8135", "name": ""}}, + "serviceCatalog": [{"endpoints": [{"adminURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135", + "id": "6bb597a3738045f4b2c51a7702037cab", "publicURL": ":8774/v2/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": + ":9292", "region": "RegionOne", "internalURL": ":9292", + "id": "2985945e07b74103bb2dfef7e426cd43", "publicURL": ":9292"}], + "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": + ":8777", "region": "RegionOne", "internalURL": ":8777", + "id": "370119dd80e84894bfe83d766fd467dd", "publicURL": ":8777"}], + "endpoints_links": [], "type": "metering", "name": "ceilometer"}, {"endpoints": + [{"adminURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "region": "RegionOne", "internalURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135", + "id": "2492a6f5fa80466d9312e51a8f79b638", "publicURL": ":8776/v1/d770443fc60a410c843dc12b98ac8135"}], + "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": + [{"adminURL": ":8773/services/Admin", "region": + "RegionOne", "internalURL": ":8773/services/Cloud", + "id": "1f68f3ce931946c788e487443e772fb2", "publicURL": ":8773/services/Cloud"}], + "endpoints_links": [], "type": "ec2", "name": "nova_ec2"}, {"endpoints": [{"adminURL": + ":35357/v2.0", "region": "RegionOne", "internalURL": + ":5000/v2.0", "id": "12c722e9b9fb471fbea83c6157c0123a", + "publicURL": ":5000/v2.0"}], "endpoints_links": + [], "type": "identity", "name": "keystone"}], "user": {"username": "", + "roles_links": [], "id": "447527294dae4a1788d36beb0db99c00", "roles": [{"name": + "Member"}], "name": ""}, "metadata": {"is_admin": + 0, "roles": ["f970c227c0ee4512899606886348f67f"]}}}' + http_version: + recorded_at: Thu, 05 Sep 2013 03:51:41 GMT +recorded_with: VCR 2.5.0 diff --git a/test/environment.yml.example b/test/environment.yml.example index 3344be6..e04fb6f 100644 --- a/test/environment.yml.example +++ b/test/environment.yml.example @@ -15,8 +15,8 @@ openstack_admin: <<: *common auth_credentials: username: aviatortest_admin - password: aviatortest_password - tenantName: aviatortest_project + password: aviatortest_password_admin + tenantName: aviatortest_project_admin # This is expected by the test suite. You may change its values freely # as long as the name 'openstack_member' doesn't change and the user's @@ -25,5 +25,5 @@ openstack_member: <<: *common auth_credentials: username: aviatortest_member - password: aviatortest_password - tenantName: aviatortest_project + password: aviatortest_password_member + tenantName: aviatortest_project_member