You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/11/24 17:25:19 UTC
[PATCH core 1/2] CIMI: Removed obsoleted CIMI unit tests
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
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
Re: [PATCH core 1/2] CIMI: Removed obsoleted CIMI unit tests
Posted by Michal Fojtik <mf...@redhat.com>.
On Nov 25, 2011, at 10:34 AM, marios@redhat.com wrote:
> ACK both patches
Thanks Marios! Pushed both.
-- Michal
>
> On 24/11/11 18:25, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mf...@redhat.com>
>>
>>
>> Signed-off-by: Michal fojtik <mf...@redhat.com>
>> ---
>> 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
>
------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
Re: [PATCH core 1/2] CIMI: Removed obsoleted CIMI unit tests
Posted by "marios@redhat.com" <ma...@redhat.com>.
ACK both patches
On 24/11/11 18:25, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
> 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
[PATCH core 2/2] CIMI: Added Cucumber feature for Machine model
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/Rakefile | 6 ++
server/tests/cimi/features/machines.feature | 35 +++++++++
.../features/step_definitions/machines_steps.rb | 80 ++++++++++++++++++++
server/tests/cimi/features/support/env.rb | 21 +++++
4 files changed, 142 insertions(+), 0 deletions(-)
create mode 100644 server/tests/cimi/features/machines.feature
create mode 100644 server/tests/cimi/features/step_definitions/machines_steps.rb
create mode 100644 server/tests/cimi/features/support/env.rb
diff --git a/server/Rakefile b/server/Rakefile
index 53fb7bf..0d52f81 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -50,6 +50,12 @@ begin
end
end
end
+ namespace :cimi do
+ Cucumber::Rake::Task.new(:machines) do |t|
+ t.cucumber_opts = "tests/cimi/features/machines.feature --format pretty"
+ t.rcov = false
+ end
+ end
rescue LoadError
end
diff --git a/server/tests/cimi/features/machines.feature b/server/tests/cimi/features/machines.feature
new file mode 100644
index 0000000..f3264d6
--- /dev/null
+++ b/server/tests/cimi/features/machines.feature
@@ -0,0 +1,35 @@
+Feature: Managing Machines
+ In order to interact with the provider
+ We must first be provided a URL to the main entry point (CEP).
+
+ Scenario: Create a New Machine
+ Given Cloud Entry Point URL is provided
+ And client retrieve the Cloud Entry Point
+ When client specifies a Machine Image
+ | machineImage | http://example.com/cimi/machine_images/img1 |
+ And client specifies a Machine Configuration
+ | machineConfig | http://example.com/cimi/machine_configurations/m1-small |
+ And client specifies a new Machine using
+ | name | sampleMachine1 |
+ | description | sampleMachine1Description |
+ Then client should be able to create this Machine
+
+ Scenario: Querying created Machine
+ Given Cloud Entry Point URL is provided
+ And client retrieve the Cloud Entry Point
+ When client query for 'sampleMachine1' Machine
+ And client should verify that this machine exists
+
+ Scenario: Stopping Machine
+ Given Cloud Entry Point URL is provided
+ And client retrieve the Cloud Entry Point
+ When client executes stop operation on Machine 'sampleMAchine1'
+ Then client should be able to query this Machine
+ And client should verify that this machine is stopped
+
+ Scenario: Starting Machine
+ Given Cloud Entry Point URL is provided
+ And client retrieve the Cloud Entry Point
+ When client executes start operation on Machine 'sampleMAchine1'
+ Then client should be able to query this Machine
+ And client should verify that this machine is started
diff --git a/server/tests/cimi/features/step_definitions/machines_steps.rb b/server/tests/cimi/features/step_definitions/machines_steps.rb
new file mode 100644
index 0000000..54c63a0
--- /dev/null
+++ b/server/tests/cimi/features/step_definitions/machines_steps.rb
@@ -0,0 +1,80 @@
+World(Rack::Test::Methods)
+
+Given /^Cloud Entry Point URL is provided$/ do
+ get '/cimi'
+ last_response.status.should == 301
+ last_response.location.should == "http://example.org/cimi/cloudEntryPoint"
+end
+
+Given /^client retrieve the Cloud Entry Point$/ do
+ get "/cimi/cloudEntryPoint"
+ header 'Accept', 'application/xml'
+ last_response.status.should == 200
+end
+
+When /^client specifies a Machine Image$/ do |machine_image|
+ header 'Accept', 'application/xml'
+ authorize 'mockuser', 'mockpassword'
+ get machine_image.raw[0][1]
+ last_response.status.should == 200
+ @machine_image = CIMI::Model::MachineImage.from_xml(last_response.body)
+ @machine_image.should_not be_nil
+ @machine_image.uri.should == machine_image.raw[0][1]
+end
+
+When /^client specifies a Machine Configuration$/ do |machine_conf|
+ header 'Accept', 'application/xml'
+ authorize 'mockuser', 'mockpassword'
+ get machine_conf.raw[0][1]
+ last_response.status.should == 200
+ @machine_configuration = CIMI::Model::MachineImage.from_xml(last_response.body)
+ @machine_configuration.should_not be_nil
+ @machine_configuration.uri.should == machine_conf.raw[0][1]
+end
+
+When /^client specifies a new Machine using$/ do |machine|
+ @machine_image.should_not be_nil
+ @machine_configuration.should_not be_nil
+ @builder = Nokogiri::XML::Builder.new do |xml|
+ xml.Machine(:xmlns => CMWG_NAMESPACE) {
+ xml.name machine.raw[0][1]
+ xml.description machine.raw[1][1]
+ xml.MachineTemplate {
+ xml.MachineConfig( :href => @machine_configuration.uri )
+ xml.MachineImage( :href => @machine_image.uri )
+ }
+ }
+ end
+end
+
+Then /^client should be able to create this Machine$/ do
+ pending "NOTE: There is an inconsistency between Primer and CIMI spec\n"
+ @machine = CIMI::Model::Machine.from_xml(@builder.to_xml)
+ authorize 'mockuser', 'mockpassword'
+ post '/cimi/machines', @machine
+ last_response.status.should == 201
+end
+
+When /^client query for '(\w+)' Machine$/ do |machine_id|
+ header 'Accept', 'application/xml'
+ authorize 'mockuser', 'mockpassword'
+ get "/cimi/machines/%s" % machine_id
+end
+
+Then /^client should verify that this machine exists$/ do
+ last_xml_response.root.name == 'Machine'
+ last_response.status == 200
+ @new_machine = last_xml_response
+end
+
+Then /^client should be able to query this Machine$/ do
+ get "/cimi/machines/%s" % (@new_machine/'')
+end
+
+When /^client executes (\w+) operation on Machine '(\w+)'$/ do |operation, machine_id|
+ pending # express the regexp above with the code you wish you had
+end
+
+Then /^client should verify that this machine is (\w+)$/ do |status|
+ pending # express the regexp above with the code you wish you had
+end
diff --git a/server/tests/cimi/features/support/env.rb b/server/tests/cimi/features/support/env.rb
new file mode 100644
index 0000000..2cd7f73
--- /dev/null
+++ b/server/tests/cimi/features/support/env.rb
@@ -0,0 +1,21 @@
+require 'rubygems'
+require 'nokogiri'
+
+ENV['API_DRIVER'] = 'mock'
+ENV['API_FRONTEND'] = 'cimi'
+ENV.delete('API_VERBOSE')
+
+$top_srcdir = File.join(File.dirname(__FILE__), '..', '..', '..', '..')
+$:.unshift File.join($top_srcdir, 'lib')
+
+load File.join($top_srcdir, 'lib', 'cimi', 'server.rb')
+
+require 'rack/test'
+
+def last_xml_response
+ Nokogiri::XML(last_response.body)
+end
+
+def app
+ Sinatra::Application
+end
--
1.7.4.4