From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- tests/deltacloud/hardware_profiles_test.rb | 28 +++++++++++++++ tests/deltacloud/instance_states_test.rb | 52 ++++++++++++++++++++++++++++ tests/deltacloud/keys_test.rb | 28 +++++++++++++++ tests/deltacloud/realms_test.rb | 29 +++++++++++++++ tests/deltacloud/storage_snapshots_test.rb | 28 +++++++++++++++ tests/deltacloud/storage_volumes_test.rb | 28 +++++++++++++++ 6 files changed, 193 insertions(+), 0 deletions(-) diff --git a/tests/deltacloud/hardware_profiles_test.rb b/tests/deltacloud/hardware_profiles_test.rb index e69de29..4e73ed5 100644 --- a/tests/deltacloud/hardware_profiles_test.rb +++ b/tests/deltacloud/hardware_profiles_test.rb @@ -0,0 +1,28 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API hardware_profiles collection' do + include Deltacloud::Test::Methods + + need_collection :hardware_profiles + + #Run the 'common' tests for all collections defined in common_tests_collections.rb + CommonCollectionsTest::run_common_tests_for("hardware_profiles") + +end diff --git a/tests/deltacloud/instance_states_test.rb b/tests/deltacloud/instance_states_test.rb index e69de29..d58d9ca 100644 --- a/tests/deltacloud/instance_states_test.rb +++ b/tests/deltacloud/instance_states_test.rb @@ -0,0 +1,52 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API instance_states collection' do + include Deltacloud::Test::Methods + + need_collection :instance_states + + it "must advertise the instance_states collection in API entrypoint" do + res = get("/").xml + (res/"api/link[@rel=instance_states]").wont_be_empty + end + + it "should respond with HTTP_OK when accessing the instance_states collection with authentication" do + res = get("instance_states") + res.code.must_equal 200 + end + + it 'should support the JSON media type' do + res = get("instance_states", :accept=>:json) + res.code.must_equal 200 + res.headers[:content_type].must_equal 'application/json' + assert_silent {JSON.parse(res)} + end + + it 'must include the ETag in HTTP headers' do + res = get("instance_states") + res.headers[:etag].wont_be_nil + end + + it "must have the instance_states element on top level" do + res = get("instance_states", :accept=>:xml) + res.xml.root.name.must_equal "instance_states" + end + +end diff --git a/tests/deltacloud/keys_test.rb b/tests/deltacloud/keys_test.rb index e69de29..fd300b5 100644 --- a/tests/deltacloud/keys_test.rb +++ b/tests/deltacloud/keys_test.rb @@ -0,0 +1,28 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API keys collection' do + include Deltacloud::Test::Methods + + need_collection :keys + + #Run the 'common' tests for all collections defined in common_tests_collections.rb + CommonCollectionsTest::run_common_tests_for("keys") + +end diff --git a/tests/deltacloud/realms_test.rb b/tests/deltacloud/realms_test.rb index e69de29..b679028 100644 --- a/tests/deltacloud/realms_test.rb +++ b/tests/deltacloud/realms_test.rb @@ -0,0 +1,29 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API realms collection' do + include Deltacloud::Test::Methods + + need_collection :realms + + #Run the 'common' tests for all collections defined in common_tests_collections.rb + CommonCollectionsTest::run_common_tests_for("realms") + +end + diff --git a/tests/deltacloud/storage_snapshots_test.rb b/tests/deltacloud/storage_snapshots_test.rb index e69de29..6daa7ff 100644 --- a/tests/deltacloud/storage_snapshots_test.rb +++ b/tests/deltacloud/storage_snapshots_test.rb @@ -0,0 +1,28 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API storage_snapshots collection' do + include Deltacloud::Test::Methods + + need_collection :storage_snapshots + + #Run the 'common' tests for all collections defined in common_tests_collections.rb + CommonCollectionsTest::run_common_tests_for("storage_snapshots") + +end diff --git a/tests/deltacloud/storage_volumes_test.rb b/tests/deltacloud/storage_volumes_test.rb index e69de29..7d2c96c 100644 --- a/tests/deltacloud/storage_volumes_test.rb +++ b/tests/deltacloud/storage_volumes_test.rb @@ -0,0 +1,28 @@ +# +# 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 "deltacloud/test_setup.rb" + +describe 'Deltacloud API storage_volumes collection' do + include Deltacloud::Test::Methods + + need_collection :storage_volumes + + #Run the 'common' tests for all collections defined in common_tests_collections.rb + CommonCollectionsTest::run_common_tests_for("storage_volumes") + +end -- 1.7.6.5
