From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- server/tests/cimi/cimi.rb | 3 - server/tests/cimi/common/cloud_entry_point_test.rb | 92 -------------------- .../cimi/common/machine_configuration_test.rb | 60 ------------- server/tests/cimi/common/machine_image_test.rb | 60 ------------- server/tests/cimi/common/machine_test.rb | 60 ------------- server/tests/cimi/common/volume_test.rb | 60 ------------- 6 files changed, 0 insertions(+), 335 deletions(-) delete mode 100644 server/tests/cimi/cimi.rb delete mode 100644 server/tests/cimi/common/cloud_entry_point_test.rb delete mode 100644 server/tests/cimi/common/machine_configuration_test.rb delete mode 100644 server/tests/cimi/common/machine_image_test.rb delete mode 100644 server/tests/cimi/common/machine_test.rb delete mode 100644 server/tests/cimi/common/volume_test.rb diff --git a/server/tests/cimi/cimi.rb b/server/tests/cimi/cimi.rb deleted file mode 100644 index 8d351ad..0000000 --- a/server/tests/cimi/cimi.rb +++ /dev/null @@ -1,3 +0,0 @@ -ENV['API_FRONTEND'] = "cimi" -ENV['API_USER'] = 'mockuser' -ENV['API_PASSWORD'] = 'mockpassword' diff --git a/server/tests/cimi/common/cloud_entry_point_test.rb b/server/tests/cimi/common/cloud_entry_point_test.rb deleted file mode 100644 index dc7cb36..0000000 --- a/server/tests/cimi/common/cloud_entry_point_test.rb +++ /dev/null @@ -1,92 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') -require 'tests/common' -require 'nokogiri' - -module CimiUnitTest - class CloudEntryPointTest < Test::Unit::TestCase - include Rack::Test::Methods - - def app - Sinatra::Application - end - - def test_it_redirect_client_to_entrypoint - get_url '/cimi' - last_response.status.should == 301 - last_response.header['Location'].should == 'http://example.org/cimi/cloudEntryPoint' - end - - def test_it_return_valid_content_type - get_url '/cimi/cloudEntryPoint' - last_response.content_type.should == 'application/CIMI-CloudEntryPoint+xml;charset=utf-8' - end - - def test_it_return_valid_xmlns - get_url '/cimi/cloudEntryPoint' - (last_xml_response/'CloudEntryPoint').first.namespace.href.should == CMWG_NAMESPACE - end - - def test_it_return_valid_root_element - get_url '/cimi/cloudEntryPoint' - last_xml_response.root.name == "CloudEntryPoint" - end - - def test_it_include_all_properties - get_url '/cimi/cloudEntryPoint' - properties = ['uri', 'name', 'description', 'created', 'volumes', 'machines', 'machineImages', 'machineConfigurations'].sort - (last_xml_response/'CloudEntryPoint/*').collect { |p| p.name }.sort.should == properties - end - - def test_collection_have_href_attributes - get_url '/cimi/cloudEntryPoint' - collections = [ 'volumes', 'machines', 'machineImages', 'machineConfigurations' ] - (last_xml_response/'CloudEntryPoint/*').each do |collection| - collection[:href].should_not nil - end - end - - def test_collection_href_attributes_are_valid - valid_uris = { - 'volumes' => 'cimi/volumes', - 'machines' => 'cimi/machines', - 'machineImages' => 'cimi/machine_images', - 'machineConfiguration' => 'cimi/machine_configurations' - } - get_url '/cimi/cloudEntryPoint' - (last_xml_response/'CloudEntryPoint/*').each do |collection| - next unless valid_uris.keys.include? collection.name - collection[:href].should =~ /#{valid_uris[collection.name]}$/ - end - end - - def test_it_respond_to_json - get_url '/cimi/cloudEntryPoint', {}, :format => :json - JSON::parse(last_response.body).class.should == Hash - end - - def test_json_include_all_properties - get_url '/cimi/cloudEntryPoint', {}, :format => :json - properties = ['uri', 'name', 'description', 'created', 'volumes', 'machines', 'machineImages', 'machineConfigurations'].sort - properties.each do |property| - JSON::parse(last_response.body).keys.include?(property).should == true - end - end - - end -end diff --git a/server/tests/cimi/common/machine_configuration_test.rb b/server/tests/cimi/common/machine_configuration_test.rb deleted file mode 100644 index c28312f..0000000 --- a/server/tests/cimi/common/machine_configuration_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') -require 'tests/common' -require 'nokogiri' - -module CimiUnitTest - class MachineConfigurationTest < Test::Unit::TestCase - include Rack::Test::Methods - - def app - Sinatra::Application - end - - #setup the url to access a machine. this will be used by all the test cases in this class - def setup - if @checked.nil? - get_url '/cimi/cloudEntryPoint' - configurations = last_xml_response/'CloudEntryPoint/machineConfigurations' - if configurations - get_auth_url configurations.attr('href') - elements = last_xml_response/'MachineConfigurationCollection/machineConfiguration' - if elements.size > 0 - @access_url = elements[0].attr('href') - end - end - @checked = true - end - end - - def test_machine_configuration_read_to_xml - if @access_url - get_auth_url @access_url, {}, :format => :xml - last_response.status.should == 200 - end - end - - def test_machine_configuration_read_to_json - if @access_url - get_auth_url @access_url, {}, :format => :json - last_response.status.should == 200 - end - end - - end -end diff --git a/server/tests/cimi/common/machine_image_test.rb b/server/tests/cimi/common/machine_image_test.rb deleted file mode 100644 index e271449..0000000 --- a/server/tests/cimi/common/machine_image_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') -require 'tests/common' -require 'nokogiri' - -module CimiUnitTest - class MachineImageTest < Test::Unit::TestCase - include Rack::Test::Methods - - def app - Sinatra::Application - end - - #setup the url to access a machine. this will be used by all the test cases in this class - def setup - if @checked.nil? - get_url '/cimi/cloudEntryPoint' - images = last_xml_response/'CloudEntryPoint/machineImages' - if images - get_auth_url images.attr('href') - elements = last_xml_response/'MachineImageCollection/machineImage' - if elements.size > 0 - @access_url = elements[0].attr('href') - end - end - @checked = true - end - end - - def test_machine_image_read_to_xml - if @access_url - get_auth_url @access_url, {}, :format => :xml - last_response.status.should == 200 - end - end - - def test_machine_image_read_to_json - if @access_url - get_auth_url @access_url, {}, :format => :json - last_response.status.should == 200 - end - end - - end -end diff --git a/server/tests/cimi/common/machine_test.rb b/server/tests/cimi/common/machine_test.rb deleted file mode 100644 index 2fda201..0000000 --- a/server/tests/cimi/common/machine_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') -require 'tests/common' -require 'nokogiri' - -module CimiUnitTest - class MachineTest < Test::Unit::TestCase - include Rack::Test::Methods - - def app - Sinatra::Application - end - - #setup the url to access a machine. this will be used by all the test cases in this class - def setup - if @checked.nil? - get_url '/cimi/cloudEntryPoint' - machines = (last_xml_response/'CloudEntryPoint/machines') - if machines - get_auth_url machines.attr('href') - elements = last_xml_response/'MachineCollection/machine' - if elements.size > 0 - @access_url = elements[0].attr('href') - end - end - @checked = true - end - end - - def test_machine_read_to_xml - if @access_url - get_auth_url @access_url, {}, :format => :xml - last_response.status.should == 200 - end - end - - def test_machine_read_to_json - if @access_url - get_auth_url @access_url, {}, :format => :json - last_response.status.should == 200 - end - end - - end -end diff --git a/server/tests/cimi/common/volume_test.rb b/server/tests/cimi/common/volume_test.rb deleted file mode 100644 index 9788309..0000000 --- a/server/tests/cimi/common/volume_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') -require 'tests/common' -require 'nokogiri' - -module CimiUnitTest - class VolumeTest < Test::Unit::TestCase - include Rack::Test::Methods - - def app - Sinatra::Application - end - - #setup the url to access a machine. this will be used by all the test cases in this class - def setup - if @checked.nil? - get_url '/cimi/cloudEntryPoint' - volumes = (last_xml_response/'CloudEntryPoint/volumes') - if volumes - get_auth_url volumes.attr('href') - elements = last_xml_response/'VolumeCollection/volume' - if elements.size > 0 - @access_url = elements[0].attr('href') - end - end - @checked = true - end - end - - def test_volume_read_to_xml - if @access_url - get_auth_url @access_url, {}, :format => :xml - last_response.status.should == 200 - end - end - - def test_volume_read_to_json - if @access_url - get_auth_url @access_url, {}, :format => :json - last_response.status.should == 200 - end - end - - end -end -- 1.7.4.4
