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 2012/08/08 14:54:34 UTC

[PATCH core 1/6] Client: Moved all tests to tests directory

From: Michal Fojtik <mf...@redhat.com>

* Removed obsoleted fixtures. They are provided by deltacloud-core

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/specs/.gitignore                           |    1 -
 client/specs/buckets_spec.rb                      |  148 ---------------
 client/specs/content_spec.rb                      |  137 --------------
 client/specs/errors_spec.rb                       |   59 ------
 client/specs/fixtures/images/img1.yml             |    4 -
 client/specs/fixtures/images/img2.yml             |    4 -
 client/specs/fixtures/images/img3.yml             |    4 -
 client/specs/fixtures/instances/inst0.yml         |   16 --
 client/specs/fixtures/instances/inst1.yml         |    9 -
 client/specs/fixtures/instances/inst2.yml         |    9 -
 client/specs/fixtures/storage_snapshots/snap1.yml |    4 -
 client/specs/fixtures/storage_snapshots/snap2.yml |    4 -
 client/specs/fixtures/storage_snapshots/snap3.yml |    4 -
 client/specs/fixtures/storage_volumes/vol1.yml    |    7 -
 client/specs/fixtures/storage_volumes/vol2.yml    |    7 -
 client/specs/fixtures/storage_volumes/vol3.yml    |    7 -
 client/specs/hardware_profiles_spec.rb            |   80 --------
 client/specs/images_spec.rb                       |  107 -----------
 client/specs/initialization_spec.rb               |   64 -------
 client/specs/instance_states_spec.rb              |   80 --------
 client/specs/instances_spec.rb                    |  210 ---------------------
 client/specs/keys_spec.rb                         |   97 ----------
 client/specs/realms_spec.rb                       |   66 -------
 client/specs/shared/resources.rb                  |   30 ---
 client/specs/spec_helper.rb                       |   53 ------
 client/specs/storage_snapshot_spec.rb             |   81 --------
 client/specs/storage_volume_spec.rb               |   91 ---------
 client/tests/buckets_test.rb                      |  148 +++++++++++++++
 client/tests/client_test.rb                       |   64 +++++++
 client/tests/content_negotiation_tests.rb         |  137 ++++++++++++++
 client/tests/errors_test.rb                       |   59 ++++++
 client/tests/hardware_profiles_test.rb            |   80 ++++++++
 client/tests/images_test.rb                       |  107 +++++++++++
 client/tests/instance_states_test.rb              |   80 ++++++++
 client/tests/instances_test.rb                    |  210 +++++++++++++++++++++
 client/tests/keys_tests.rb                        |   97 ++++++++++
 client/tests/realms_test.rb                       |   66 +++++++
 client/tests/storage_snapshot_test.rb             |   81 ++++++++
 client/tests/storage_volume_test.rb               |   91 +++++++++
 39 files changed, 1220 insertions(+), 1383 deletions(-)
 delete mode 100644 client/specs/.gitignore
 delete mode 100644 client/specs/buckets_spec.rb
 delete mode 100644 client/specs/content_spec.rb
 delete mode 100644 client/specs/errors_spec.rb
 delete mode 100644 client/specs/fixtures/images/.gitignore
 delete mode 100644 client/specs/fixtures/images/img1.yml
 delete mode 100644 client/specs/fixtures/images/img2.yml
 delete mode 100644 client/specs/fixtures/images/img3.yml
 delete mode 100644 client/specs/fixtures/instances/.gitignore
 delete mode 100644 client/specs/fixtures/instances/inst0.yml
 delete mode 100644 client/specs/fixtures/instances/inst1.yml
 delete mode 100644 client/specs/fixtures/instances/inst2.yml
 delete mode 100644 client/specs/fixtures/storage_snapshots/.gitignore
 delete mode 100644 client/specs/fixtures/storage_snapshots/snap1.yml
 delete mode 100644 client/specs/fixtures/storage_snapshots/snap2.yml
 delete mode 100644 client/specs/fixtures/storage_snapshots/snap3.yml
 delete mode 100644 client/specs/fixtures/storage_volumes/.gitignore
 delete mode 100644 client/specs/fixtures/storage_volumes/vol1.yml
 delete mode 100644 client/specs/fixtures/storage_volumes/vol2.yml
 delete mode 100644 client/specs/fixtures/storage_volumes/vol3.yml
 delete mode 100644 client/specs/hardware_profiles_spec.rb
 delete mode 100644 client/specs/images_spec.rb
 delete mode 100644 client/specs/initialization_spec.rb
 delete mode 100644 client/specs/instance_states_spec.rb
 delete mode 100644 client/specs/instances_spec.rb
 delete mode 100644 client/specs/keys_spec.rb
 delete mode 100644 client/specs/realms_spec.rb
 delete mode 100644 client/specs/shared/resources.rb
 delete mode 100644 client/specs/spec_helper.rb
 delete mode 100644 client/specs/storage_snapshot_spec.rb
 delete mode 100644 client/specs/storage_volume_spec.rb
 create mode 100644 client/tests/buckets_test.rb
 create mode 100644 client/tests/client_test.rb
 create mode 100644 client/tests/content_negotiation_tests.rb
 create mode 100644 client/tests/errors_test.rb
 create mode 100644 client/tests/hardware_profiles_test.rb
 create mode 100644 client/tests/images_test.rb
 create mode 100644 client/tests/instance_states_test.rb
 create mode 100644 client/tests/instances_test.rb
 create mode 100644 client/tests/keys_tests.rb
 create mode 100644 client/tests/realms_test.rb
 create mode 100644 client/tests/storage_snapshot_test.rb
 create mode 100644 client/tests/storage_volume_test.rb

diff --git a/client/specs/.gitignore b/client/specs/.gitignore
deleted file mode 100644
index 1269488..0000000
--- a/client/specs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-data
diff --git a/client/specs/buckets_spec.rb b/client/specs/buckets_spec.rb
deleted file mode 100644
index b897e0c..0000000
--- a/client/specs/buckets_spec.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-describe "buckets" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all buckets" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        buckets = client.buckets
-        buckets.should_not be_empty
-        buckets.each do |bucket|
-          bucket.uri.should_not be_nil
-          bucket.uri.should be_a( String )
-          bucket.name.should_not be_nil
-          bucket.name.should be_a(String)
-        end
-      end
-    end
-  end
-
-  it "should allow retrieval of a named bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
-      bucket.uri.should eql(API_URL + "/buckets/bucket1")
-      bucket.size.should eql(3.0)
-      bucket.name.should_not be_nil
-      bucket.name.should be_a(String)
-      blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
-    end
-  end
-
-end
-
-describe "Operations on buckets" do
-
-  it "should allow creation of a new bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_bucket = client.create_bucket({'id' => "my_new_bucket"})
-      new_bucket.should_not be_nil
-      new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
-      new_bucket.name.should_not be_nil
-      new_bucket.name.should be_a(String)
-      new_bucket.name.should eql("my_new_bucket")
-    end
-  end
-
-  it "should allow deletion of an existing bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_bucket = client.bucket("my_new_bucket")
-      new_bucket.should_not be_nil
-      new_bucket.name.should eql("my_new_bucket")
-      lambda{
-              client.destroy_bucket({'id' => "my_new_bucket"})
-            }.should_not raise_error
-    end
-  end
-
-  it "should throw error if you delete a non existing bucket" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_bucket({'id' => "i_dont_exist"})
-            }.should raise_error
-    end
-  end
-
-end
-
-describe "Blobs" do
-
-  it "should allow retrieval of a bucket's blobs" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
-      blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
-      blob_list.each do |b_id|
-        blob = client.blob({"bucket" => bucket.name, :id => b_id})
-        puts blob.inspect
-        blob.bucket.should_not be_nil
-        blob.bucket.should be_a(String)
-        blob.bucket.should eql(bucket.name)
-        blob.content_length.should_not be_nil
-        blob.content_length.should be_a(Float)
-        blob.content_length.should >= 0
-        blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
-        blob_data.size.to_f.should == blob.content_length
-        blob.last_modified.should_not be_nil
-      end
-    end
-  end
-
-end
-
-describe "Operations on blobs" do
-
-  it "should successfully create a new blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      blob_data = File.new("./blob_data_file", "w+")
-
-      blob_data.write("this is some blob data \n")
-      blob_data.rewind
-      some_new_blob = client.create_blob({:id => "some_new_blob",
-                          'bucket' => "bucket1",
-                          'file_path' => blob_data.path})
-      some_new_blob.should_not be_nil
-      some_new_blob.content_length.should_not be_nil
-      some_new_blob.content_length.should eql(24.0)
-      File.delete(blob_data.path)
-    end
-  end
-
-  it "should allow deletion of an existing blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
-            }.should_not raise_error
-    end
-  end
-
-  it "should throw error if you delete a non existing blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
-            }.should raise_error
-    end
-  end
-end
diff --git a/client/specs/content_spec.rb b/client/specs/content_spec.rb
deleted file mode 100644
index ffd222c..0000000
--- a/client/specs/content_spec.rb
+++ /dev/null
@@ -1,137 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-def client
-  RestClient::Resource.new(API_URL)
-end
-
-def headers(header)
-  encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
-  { :authorization => "Basic " + encoded_credentials }.merge(header)
-end
-
-describe "return JSON" do
-
-  it 'should return JSON when using application/json, */*' do
-    header_hash = {
-      # FIXME: There is a bug in rack-accept that cause to respond with HTML
-      # to the configuration below.
-      #
-      # 'Accept' => "application/json, */*"
-      'Accept' => "application/json"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
-    end
-  end
-
-  it 'should return JSON when using just application/json' do
-    header_hash = {
-      'Accept' => "application/json"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
-    end
-  end
-
-end
-
-describe "return HTML in different browsers" do
-
-  it "wants XML using format parameter" do
-    client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "raise 406 error on wrong accept" do
-    client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
-      response.code.should == 406
-    end
-  end
-
-  it "wants HTML using format parameter and accept set to XML" do
-    client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-#  FIXME: This return 406 for some reason on GIT sinatra
-#  it "wants a PNG image" do 
-#    client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
-#      response.code.should == 200
-#      response.headers[:content_type].should =~ /^image\/png/
-#    end
-#  end
-
-  it "doesn't have accept header" do
-    client.get('Accept' => '') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "can handle unknown formats" do
-    client.get('Accept' => 'format/unknown') do |response, request, &block|
-      response.code.should == 406
-    end
-  end
-
-  it "wants explicitly XML" do
-    client.get('Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
-    end
-  end
-
-  it "Internet Explorer" do
-    header_hash = {
-      'Accept' => "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*",
-      'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-  it "Mozilla Firefox" do
-    client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-  it "Opera" do
-    header_hash = { 
-      'Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
-      'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
-    }
-    client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
-    end
-  end
-
-end
diff --git a/client/specs/errors_spec.rb b/client/specs/errors_spec.rb
deleted file mode 100644
index 031e3b7..0000000
--- a/client/specs/errors_spec.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-describe "server error handler" do
-
-  it_should_behave_like "all resources"
-
-  it 'should capture HTTP 500 error as DeltacloudError' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
-    end
-  end
-
-  it 'should capture HTTP 502 error as ProviderError' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
-    end
-  end
-
-  it 'should capture HTTP 501 error as NotImplemented' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
-    end
-  end
-
-  it 'should capture HTTP 504 error as ProviderTimeout' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
-    end
-  end
-
-end
-
-describe "client error handler" do
-
-  it 'should capture HTTP 404 error as NotFound' do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
-    end
-  end
-
-end
diff --git a/client/specs/fixtures/images/.gitignore b/client/specs/fixtures/images/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/client/specs/fixtures/images/img1.yml b/client/specs/fixtures/images/img1.yml
deleted file mode 100644
index 98d8214..0000000
--- a/client/specs/fixtures/images/img1.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: Fedora 10
-:owner_id: fedoraproject
-:architecture: x86_64
-:id: img1
diff --git a/client/specs/fixtures/images/img2.yml b/client/specs/fixtures/images/img2.yml
deleted file mode 100644
index 4508446..0000000
--- a/client/specs/fixtures/images/img2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: Fedora 10
-:owner_id: fedoraproject
-:architecture: i386
-:id: img2
diff --git a/client/specs/fixtures/images/img3.yml b/client/specs/fixtures/images/img3.yml
deleted file mode 100644
index d9e33b0..0000000
--- a/client/specs/fixtures/images/img3.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:description: JBoss
-:owner_id: mockuser
-:architecture: i386
-:id: img3
diff --git a/client/specs/fixtures/instances/.gitignore b/client/specs/fixtures/instances/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/client/specs/fixtures/instances/inst0.yml b/client/specs/fixtures/instances/inst0.yml
deleted file mode 100644
index a5b73be..0000000
--- a/client/specs/fixtures/instances/inst0.yml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-:realm_id: us
-:public_addresses:
-- img1.inst0.public.com
-:state: RUNNING
-:name: "Mock Instance With Profile Change"
-:private_addresses:
-- img1.inst0.private.com
-:image_id: img1
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-large
-  memory: "12288"
-:owner_id: mockuser
-:actions:
-- :reboot
-- :stop
diff --git a/client/specs/fixtures/instances/inst1.yml b/client/specs/fixtures/instances/inst1.yml
deleted file mode 100644
index 3544d40..0000000
--- a/client/specs/fixtures/instances/inst1.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-:name: MockUserInstance
-:state: RUNNING
-:image_id: img3
-:owner_id: mockuser
-:public_addresses: [ img3.inst1.public.com ]
-:private_addresses: [ img3.inst1.private.com ]
-:realm_id: us
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-small
diff --git a/client/specs/fixtures/instances/inst2.yml b/client/specs/fixtures/instances/inst2.yml
deleted file mode 100644
index 9a70cb8..0000000
--- a/client/specs/fixtures/instances/inst2.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-:name: AnotherInstance
-:state: RUNNING
-:image_id: img1
-:owner_id: anotheruser
-:public_addresses: [ img1.inst2.public.com ]
-:private_addresses: [ img1.inst2.private.com ]
-:realm_id: us
-:instance_profile: !ruby/object:InstanceProfile
-  id: m1-large
diff --git a/client/specs/fixtures/storage_snapshots/.gitignore b/client/specs/fixtures/storage_snapshots/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/client/specs/fixtures/storage_snapshots/snap1.yml b/client/specs/fixtures/storage_snapshots/snap1.yml
deleted file mode 100644
index 180a2c7..0000000
--- a/client/specs/fixtures/storage_snapshots/snap1.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: fedoraproject
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol1
diff --git a/client/specs/fixtures/storage_snapshots/snap2.yml b/client/specs/fixtures/storage_snapshots/snap2.yml
deleted file mode 100644
index f68c8ce..0000000
--- a/client/specs/fixtures/storage_snapshots/snap2.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: mockuser
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol2
diff --git a/client/specs/fixtures/storage_snapshots/snap3.yml b/client/specs/fixtures/storage_snapshots/snap3.yml
deleted file mode 100644
index f68c8ce..0000000
--- a/client/specs/fixtures/storage_snapshots/snap3.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-:owner_id: mockuser
-:created: Wed Jul 29 18:15:24 UTC 2009
-:state: COMPLETED
-:storage_volume_id: vol2
diff --git a/client/specs/fixtures/storage_volumes/.gitignore b/client/specs/fixtures/storage_volumes/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/client/specs/fixtures/storage_volumes/vol1.yml b/client/specs/fixtures/storage_volumes/vol1.yml
deleted file mode 100644
index 54ea706..0000000
--- a/client/specs/fixtures/storage_volumes/vol1.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: fedoraproject
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: AVAILABLE
-:capacity: 1
-:realm_id: us
-:device:
-:instance_id:
diff --git a/client/specs/fixtures/storage_volumes/vol2.yml b/client/specs/fixtures/storage_volumes/vol2.yml
deleted file mode 100644
index 4103e80..0000000
--- a/client/specs/fixtures/storage_volumes/vol2.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: mockuser
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: AVAILABLE
-:capacity: 1
-:device:
-:realm_id: us
-:instance_id:
diff --git a/client/specs/fixtures/storage_volumes/vol3.yml b/client/specs/fixtures/storage_volumes/vol3.yml
deleted file mode 100644
index 9ab2453..0000000
--- a/client/specs/fixtures/storage_volumes/vol3.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-:owner_id: mockuser
-:created: Thu Jul 30 14:35:11 UTC 2009
-:state: IN-USE
-:capacity: 1
-:realm_id: us
-:device: /dev/sda1
-:instance_id: inst1
diff --git a/client/specs/hardware_profiles_spec.rb b/client/specs/hardware_profiles_spec.rb
deleted file mode 100644
index 59bfae0..0000000
--- a/client/specs/hardware_profiles_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-def prop_check(prop, value_class)
-  if prop.present?
-    prop.value.should_not be_nil
-    prop.value.should be_a(value_class)
-  end
-end
-
-describe "hardware_profiles" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all hardware profiles" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        hardware_profiles = client.hardware_profiles
-        hardware_profiles.should_not be_empty
-        hardware_profiles.each do |hwp|
-          hwp.uri.should_not be_nil
-          hwp.uri.should be_a(String)
-          prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
-       end
-      end
-    end
-  end
-
-  it "should allow filtering of hardware_profiles by architecture" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hardware_profiles = client.hardware_profiles( :architecture=>'i386' )
-      hardware_profiles.should_not be_empty
-      hardware_profiles.size.should eql( 2 )
-      hardware_profiles.first.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should allow fetching a hardware_profile by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = client.hardware_profile( 'm1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
-    end
-  end
-
-  it "should allow fetching different hardware_profiles" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    hwp1 = client.hardware_profile( 'm1-small' )
-    hwp2 = client.hardware_profile( 'm1-large' )
-    hwp1.storage.value.should_not eql(hwp2.storage.value)
-    hwp1.memory.value.should_not eql(hwp2.memory.value)
-  end
-
-  it "should allow fetching a hardware_profile by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = client.fetch_hardware_profile( API_URL + '/hardware_profiles/m1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
-    end
-  end
-
-end
diff --git a/client/specs/images_spec.rb b/client/specs/images_spec.rb
deleted file mode 100644
index 3b209cd..0000000
--- a/client/specs/images_spec.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-describe "images" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all images" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        images = client.images
-        images.should_not be_empty
-        images.size.should eql( 3 )
-        images.each do |image|
-          image.uri.should_not be_nil
-          image.uri.should be_a(String)
-          image.description.should_not be_nil
-          image.description.should be_a(String)
-          image.architecture.should_not be_nil
-          image.architecture.should be_a(String)
-          image.owner_id.should_not be_nil
-          image.owner_id.should be_a(String)
-        end
-      end
-    end
-  end
-
-  it "should allow retrieval of my own images" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      images = client.images( :owner_id=>:self )
-      images.should_not be_empty
-      images.size.should eql( 1 )
-      images.each do |image|
-        image.uri.should_not be_nil
-        image.uri.should be_a(String)
-        image.description.should_not be_nil
-        image.description.should be_a(String)
-        image.architecture.should_not be_nil
-        image.architecture.should be_a(String)
-        image.owner_id.should_not be_nil
-        image.owner_id.should be_a(String)
-      end
-    end
-  end
-
-  it "should allow retrieval of a single image by ID" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      image = client.image( 'img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
-    end
-  end
-
-  it "should allow retrieval of a single image by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      image = client.fetch_image( API_URL + '/images/img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
-    end
-  end
-
-  describe "filtering by architecture" do
-    it "return matching images" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        images = client.images( :architecture=>'x86_64' )
-        images.should_not be_empty
-        images.each do |image|
-          image.architecture.should eql( 'x86_64' )
-        end
-        images = client.images( :architecture=>'i386' )
-        images.should_not be_empty
-        images.each do |image|
-          image.architecture.should eql( 'i386' )
-        end
-      end
-    end
-
-    it "should return an empty array for no matches" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        images = client.images( :architecture=>'8088' )
-        images.should be_empty
-      end
-    end
-  end
-end
diff --git a/client/specs/initialization_spec.rb b/client/specs/initialization_spec.rb
deleted file mode 100644
index b4c1a75..0000000
--- a/client/specs/initialization_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-describe "initializing the client" do
-
-  it "should parse valid API URIs" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.api_host.should eql( API_HOST )
-    client.api_port.should eql( API_PORT.to_i )
-    client.api_path.should eql( API_PATH )
-  end
-
-  it "should discover entry points upon connection" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( "name", "password", entry_point ) do |client|
-        client.entry_points[:hardware_profiles].should eql( "#{API_URL}/hardware_profiles" )
-        client.entry_points[:images].should            eql( "#{API_URL}/images" )
-        client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
-        client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage_volumes" )
-        client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage_snapshots" )
-        client.entry_points[:buckets].should           eql( "#{API_URL}/buckets")
-        client.entry_points[:keys].should              eql( "#{API_URL}/keys")
-      end
-    end
-  end
-
-  it "should provide the current driver name via client" do
-    DeltaCloud.new( "name", "password", API_URL ) do |client|
-      client.driver_name.should eql( 'mock' )
-    end
-  end
-
-  it "should provide the current driver name without client" do
-    DeltaCloud.driver_name( API_URL ).should eql( 'mock' )
-  end
-
-  describe "without a block" do
-    before( :each ) do
-      reload_fixtures
-    end
-    it "should connect without a block" do
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-      client.images.should_not be_nil
-    end
-  end
-
-end
diff --git a/client/specs/instance_states_spec.rb b/client/specs/instance_states_spec.rb
deleted file mode 100644
index c79c273..0000000
--- a/client/specs/instance_states_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-=begin
-Spec::Matchers.define :include_transition do |action,to|
-  match do |transitions|
-    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
-    ! found.nil?
-  end
-end
-=end
-
-describe "instance-states" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of instance-state information" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        instance_states = client.instance_states
-        instance_states.should_not be_nil
-        instance_states.should_not be_empty
-
-        instance_states[0].name.should eql( 'start' )
-        instance_states[0].transitions.size.should eql( 1 )
-        instance_states[0].transitions[0].should_not be_auto
-
-        instance_states[1].name.should eql( 'pending' )
-        instance_states[1].transitions.size.should eql( 1 )
-        instance_states[1].transitions[0].should be_auto
-
-        instance_states[2].name.should eql( 'running' )
-        instance_states[2].transitions.size.should eql( 2 )
-        includes_transition( instance_states[2].transitions, :reboot, :running ).should be_true
-        includes_transition( instance_states[2].transitions, :stop, :stopped ).should be_true
-      end
-    end
-  end
-
-  it "should allow retrieval of a single instance-state blob" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance_state = client.instance_state( :pending )
-      instance_state.should_not be_nil
-      instance_state.name.should eql( 'pending' )
-      instance_state.transitions.size.should eql( 1 )
-      instance_state.transitions[0].should be_auto
-
-      instance_state = client.instance_state( :running )
-      instance_state.name.should eql( 'running' )
-      instance_state.transitions.size.should eql( 2 )
-      includes_transition( instance_state.transitions, :reboot, :running ).should be_true
-      includes_transition( instance_state.transitions, :stop, :stopped ).should be_true
-    end
-  end
-
-  def includes_transition( transitions, action, to )
-    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
-    ! found.nil?
-  end
-
-
-end
diff --git a/client/specs/instances_spec.rb b/client/specs/instances_spec.rb
deleted file mode 100644
index f7fc7e7..0000000
--- a/client/specs/instances_spec.rb
+++ /dev/null
@@ -1,210 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-describe "instances" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all instances" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        instances = client.instances
-        instances.should_not be_empty
-        instances.each do |instance|
-          instance.uri.should_not be_nil
-          instance.uri.should be_a( String )
-          instance.owner_id.should_not be_nil
-          instance.owner_id.should be_a( String )
-          instance.image.should_not be_nil
-          instance.image.to_s.should match(/DeltaCloud::API::.*::Image/)
-          instance.hardware_profile.should_not be_nil
-          instance.hardware_profile.should be_a( DeltaCloud::API::Base::HardwareProfile )
-          instance.state.should_not be_nil
-          instance.state.should be_a( String )
-          instance.public_addresses.should_not be_nil
-          instance.public_addresses.should_not be_empty
-          instance.public_addresses.should be_a( Array )
-          instance.private_addresses.should_not be_nil
-          instance.private_addresses.should_not be_empty
-          instance.private_addresses.should be_a( Array )
-        end
-      end
-    end
-  end
-
-  it "should allow navigation from instance to image" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instances = client.instances
-      instances.should_not be_empty
-      instance = instances.first
-      instance.image.should_not be_nil
-      instance.image.description.should_not be_nil
-      instance.image.description.should be_a(String)
-    end
-  end
-
-  it "should allow retrieval of a single instance" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.instance( "inst0" )
-      instance.should_not be_nil
-      instance.name.should_not be_nil
-      instance.name.should eql( 'Mock Instance With Profile Change' )
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
-      instance.owner_id.should eql( "mockuser" )
-      instance.public_addresses.first.class.should eql(Hash)
-      instance.public_addresses.first[:type].should eql('hostname')
-      instance.public_addresses.first[:address].should eql('img1.inst0.public.com')
-      instance.image.should_not be_nil
-      instance.image.uri.should eql( API_URL + "/images/img1" )
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.uri.should eql( API_URL + "/hardware_profiles/m1-large" )
-      instance.hardware_profile.memory.value.should eql('10240')
-      instance.hardware_profile.storage.value.should eql('850')
-      instance.state.should eql( "RUNNING" )
-      instance.actions.should_not be_nil
-    end
-  end
-
-  it "should allow creation of new instances with reasonable defaults" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :name=>'TestInstance', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.name.should eql( 'TestInstance' )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific realm" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :realm=>'eu', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'eu' )
-    end
-  end
-
-  it "should allow creation of new instances with specific hardware profile" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1',
-                                         :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific hardware profile overriding memory" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      hwp = { :id => 'm1-xlarge', :memory => 32768 }
-      instance = client.create_instance( 'img1', :hardware_profile=> hwp )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.hardware_profile.memory.value.should eql('12288')
-      instance.realm.id.should eql( 'us' )
-    end
-  end
-
-  it "should allow creation of new instances with specific realm and hardware profile" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.create_instance( 'img1', :realm=>'eu',
-                                         :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'eu' )
-    end
-  end
-
-  it "should allow fetching of instances by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.instance( 'inst1' )
-      instance.should_not be_nil
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
-    end
-  end
-
-  it "should allow fetching of instances by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      instance = client.fetch_instance( API_URL + '/instances/inst1' )
-      instance.should_not be_nil
-      instance.uri.should eql( API_URL + '/instances/inst1' )
-      instance.id.should eql( 'inst1' )
-    end
-  end
-
-  describe "performing actions on instances" do
-    it "should allow actions that are valid" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.instance( 'inst1' )
-        instance.should_not be_nil
-        instance.state.should eql( "RUNNING" )
-        instance.uri.should eql( API_URL + '/instances/inst1' )
-        instance.id.should eql( 'inst1' )
-        instance.stop!
-        instance.state.should eql( "STOPPED" )
-        instance.start!
-        instance.state.should eql( "RUNNING" )
-      end
-    end
-
-    it "should not allow actions that are invalid" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.instance( 'inst1' )
-        instance.should_not be_nil
-        unless instance.state.eql?("RUNNING")
-          instance.start!
-        end
-        instance.state.should eql( "RUNNING" )
-        lambda{instance.start!}.should raise_error
-      end
-    end
-
-    it "should not throw exception when destroying an instance" do
-      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-        instance = client.create_instance( 'img1',
-                                           :name=>'TestDestroyInstance',
-                                           :hardware_profile => 'm1-xlarge' )
-        instance.stop!
-        lambda {
-          instance.destroy!
-        }.should_not raise_error
-      end
-    end
-  end
-end
diff --git a/client/specs/keys_spec.rb b/client/specs/keys_spec.rb
deleted file mode 100644
index fa2ff54..0000000
--- a/client/specs/keys_spec.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Copyright (C) 2009-2011  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-def check_key(the_key, key_name = "")
-  the_key.should_not be_nil
-  the_key.id.should be_a(String)
-  the_key.id.should eql(key_name)
-  the_key.actions.should_not be_nil
-  the_key.actions.size.should eql(1)
-  the_key.actions.first[0].should eql("destroy")
-  the_key.actions.first[1].should eql("#{API_URL}/keys/#{key_name}")
-  the_key.fingerprint.should_not be_nil
-  the_key.fingerprint.should be_a(String)
-  the_key.pem.should_not be_nil
-  the_key.pem.first.should be_a(String)
-end
-
-def create_key_if_necessary(client, key_name)
-  the_key = client.key(key_name)
-  unless the_key
-    client.create_key()
-  end
-end
-
-
-describe "keys" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all keys" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        lambda{
-              client.keys
-              }.should_not raise_error
-      end
-    end
-  end
-end
-
-describe "operations on keys" do
-
-  it "should allow successful creation of a new key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      new_key = client.create_key({:name => "my_new_key"})
-      check_key(new_key, "my_new_key")
-    end
-  end
-
-  it "should allow retrieval of an existing named key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      key_name = "my_new_key"
-      create_key_if_necessary(client, key_name)
-      the_key = client.key(key_name)
-      check_key(the_key, key_name)
-    end
-  end
-
-  it "should raise error if you create a key with the same name as an existing key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      name = "my_new_key"
-      create_key_if_necessary(client, name)
-      lambda{
-              client.create_key({:name => name})
-            }.should raise_error
-    end
-  end
-
-  it "should allow successful destruction of an existing key" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      name = "my_new_key"
-      create_key_if_necessary(client, name)
-      the_key = client.key(name)
-      lambda{
-              the_key.destroy!
-            }.should_not raise_error
-    end
-  end
-
-end
diff --git a/client/specs/realms_spec.rb b/client/specs/realms_spec.rb
deleted file mode 100644
index 241fb5c..0000000
--- a/client/specs/realms_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-require 'specs/spec_helper'
-
-describe "realms" do
-
-  it_should_behave_like "all resources"
-
-  it "should allow retrieval of all realms" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        realms = client.realms
-        realms.should_not be_empty
-        realms.each do |realm|
-          realm.uri.should_not be_nil
-          realm.uri.should be_a(String)
-          realm.id.should_not be_nil
-          realm.id.should be_a(String)
-          realm.name.should_not be_nil
-          realm.name.should be_a(String)
-        end
-      end
-    end
-  end
-
-
-  it "should allow fetching a realm by id" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      realm = client.realm( 'us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
-      realm.name.should eql( 'United States' )
-      realm.state.should eql( 'AVAILABLE' )
-      realm = client.realm( 'eu' )
-      realm.should_not be_nil
-      realm.id.should eql( 'eu' )
-      realm.name.should eql( 'Europe' )
-      realm.state.should eql( 'AVAILABLE' )
-    end
-  end
-
-  it "should allow fetching a realm by URI" do
-    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      realm = client.fetch_realm( API_URL + '/realms/us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
-    end
-  end
-
-end
diff --git a/client/specs/shared/resources.rb b/client/specs/shared/resources.rb
deleted file mode 100644
index 030c6d9..0000000
--- a/client/specs/shared/resources.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-shared_examples_for "all resources" do
-
-  before(:each) do
-    reload_fixtures
-  end
-
-  after(:each) do
-    #clean_fixtures
-  end
-
-end
diff --git a/client/specs/spec_helper.rb b/client/specs/spec_helper.rb
deleted file mode 100644
index b4cb95c..0000000
--- a/client/specs/spec_helper.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-require 'rubygems'
-require 'yaml'
-require 'fileutils'
-
-api_host = ENV['API_HOST']
-( api_host = 'localhost' ) if api_host.nil?
-( api_host = 'localhost' ) if api_host == ''
-
-api_port = ENV['API_PORT']
-( api_port = 3001 ) if api_port.nil?
-( api_port = 3001 ) if api_port == ''
-
-API_HOST = api_host
-API_PORT = api_port
-API_PATH = '/api'
-
-API_URL = "http://#{API_HOST}:#{API_PORT}#{API_PATH}"
-API_URL_REDIRECT = "http://#{API_HOST}:#{API_PORT}"
-API_NAME     = 'mockuser'
-API_PASSWORD = 'mockpassword'
-
-$: << File.dirname( __FILE__ ) + '/../lib'
-require 'deltacloud'
-
-def clean_fixtures
-  FileUtils.rm_rf( File.dirname( __FILE__ ) + '/data' )
-end
-
-def reload_fixtures
-  clean_fixtures
-  FileUtils.cp_r( File.dirname( __FILE__) + '/fixtures', File.dirname( __FILE__ ) + '/data' )
-end
-
-$: << File.dirname( __FILE__ )
-require 'shared/resources'
diff --git a/client/specs/storage_snapshot_spec.rb b/client/specs/storage_snapshot_spec.rb
deleted file mode 100644
index 94f149c..0000000
--- a/client/specs/storage_snapshot_spec.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-describe "storage snapshot" do
-
-  it_should_behave_like "all resources"
-
-  it "allow retrieval of all storage volumes owned by the current user" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_snapshots = client.storage_snapshots
-        storage_snapshots.should_not be_nil
-        storage_snapshots.should_not be_empty
-        ids = storage_snapshots.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'snap2' )
-        ids.should include( 'snap3' )
-      end
-    end
-  end
-
-  it "should allow fetching of storage volume by id" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.storage_snapshot( 'snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
-    end
-  end
-
-  it "should allow fetching of storage volume by URI"  do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
-    end
-  end
-
-  it "should return nil for unknown storage volume by ID" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.storage_snapshot( "bogus" )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-  it "should return nil for unknown storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-end
diff --git a/client/specs/storage_volume_spec.rb b/client/specs/storage_volume_spec.rb
deleted file mode 100644
index 8fb153e..0000000
--- a/client/specs/storage_volume_spec.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Copyright (C) 2009  Red Hat, Inc.
-#
-# 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.
-
-
-require 'specs/spec_helper'
-
-describe "storage volumes" do
-
-  it_should_behave_like "all resources"
-
-  it "allow retrieval of all storage volumes owned by the current user" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_volumes = client.storage_volumes
-        storage_volumes.should_not be_nil
-        storage_volumes.should_not be_empty
-        ids = storage_volumes.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'vol2' )
-        ids.should include( 'vol3' )
-      end
-    end
-  end
-
-  it "should allow fetching of storage volume by id" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.storage_volume( 'vol3' )
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
-      ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should allow fetching of storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
-      storage_volume.should_not be_nil
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
-      ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
-    end
-  end
-
-  it "should raise exception for unknown storage volume by ID" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.storage_volume( 'bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-  it "should raise exception for unknown storage volume by URI" do
-    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    lambda {
-      client.connect do |client|
-        client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
-      end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
-  end
-
-
-end
diff --git a/client/tests/buckets_test.rb b/client/tests/buckets_test.rb
new file mode 100644
index 0000000..b897e0c
--- /dev/null
+++ b/client/tests/buckets_test.rb
@@ -0,0 +1,148 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+describe "buckets" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all buckets" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        buckets = client.buckets
+        buckets.should_not be_empty
+        buckets.each do |bucket|
+          bucket.uri.should_not be_nil
+          bucket.uri.should be_a( String )
+          bucket.name.should_not be_nil
+          bucket.name.should be_a(String)
+        end
+      end
+    end
+  end
+
+  it "should allow retrieval of a named bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      bucket = client.bucket("bucket1")
+      bucket.should_not be_nil
+      bucket.uri.should eql(API_URL + "/buckets/bucket1")
+      bucket.size.should eql(3.0)
+      bucket.name.should_not be_nil
+      bucket.name.should be_a(String)
+      blob_list = bucket.blob_list.split(", ")
+      blob_list.size.should eql(bucket.size.to_i)
+    end
+  end
+
+end
+
+describe "Operations on buckets" do
+
+  it "should allow creation of a new bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      new_bucket = client.create_bucket({'id' => "my_new_bucket"})
+      new_bucket.should_not be_nil
+      new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
+      new_bucket.name.should_not be_nil
+      new_bucket.name.should be_a(String)
+      new_bucket.name.should eql("my_new_bucket")
+    end
+  end
+
+  it "should allow deletion of an existing bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      new_bucket = client.bucket("my_new_bucket")
+      new_bucket.should_not be_nil
+      new_bucket.name.should eql("my_new_bucket")
+      lambda{
+              client.destroy_bucket({'id' => "my_new_bucket"})
+            }.should_not raise_error
+    end
+  end
+
+  it "should throw error if you delete a non existing bucket" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_bucket({'id' => "i_dont_exist"})
+            }.should raise_error
+    end
+  end
+
+end
+
+describe "Blobs" do
+
+  it "should allow retrieval of a bucket's blobs" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      bucket = client.bucket("bucket1")
+      bucket.should_not be_nil
+      blob_list = bucket.blob_list.split(", ")
+      blob_list.size.should eql(bucket.size.to_i)
+      blob_list.each do |b_id|
+        blob = client.blob({"bucket" => bucket.name, :id => b_id})
+        puts blob.inspect
+        blob.bucket.should_not be_nil
+        blob.bucket.should be_a(String)
+        blob.bucket.should eql(bucket.name)
+        blob.content_length.should_not be_nil
+        blob.content_length.should be_a(Float)
+        blob.content_length.should >= 0
+        blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
+        blob_data.size.to_f.should == blob.content_length
+        blob.last_modified.should_not be_nil
+      end
+    end
+  end
+
+end
+
+describe "Operations on blobs" do
+
+  it "should successfully create a new blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      blob_data = File.new("./blob_data_file", "w+")
+
+      blob_data.write("this is some blob data \n")
+      blob_data.rewind
+      some_new_blob = client.create_blob({:id => "some_new_blob",
+                          'bucket' => "bucket1",
+                          'file_path' => blob_data.path})
+      some_new_blob.should_not be_nil
+      some_new_blob.content_length.should_not be_nil
+      some_new_blob.content_length.should eql(24.0)
+      File.delete(blob_data.path)
+    end
+  end
+
+  it "should allow deletion of an existing blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
+            }.should_not raise_error
+    end
+  end
+
+  it "should throw error if you delete a non existing blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      lambda{
+              client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
+            }.should raise_error
+    end
+  end
+end
diff --git a/client/tests/client_test.rb b/client/tests/client_test.rb
new file mode 100644
index 0000000..b4c1a75
--- /dev/null
+++ b/client/tests/client_test.rb
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+describe "initializing the client" do
+
+  it "should parse valid API URIs" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.api_host.should eql( API_HOST )
+    client.api_port.should eql( API_PORT.to_i )
+    client.api_path.should eql( API_PATH )
+  end
+
+  it "should discover entry points upon connection" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( "name", "password", entry_point ) do |client|
+        client.entry_points[:hardware_profiles].should eql( "#{API_URL}/hardware_profiles" )
+        client.entry_points[:images].should            eql( "#{API_URL}/images" )
+        client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
+        client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage_volumes" )
+        client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage_snapshots" )
+        client.entry_points[:buckets].should           eql( "#{API_URL}/buckets")
+        client.entry_points[:keys].should              eql( "#{API_URL}/keys")
+      end
+    end
+  end
+
+  it "should provide the current driver name via client" do
+    DeltaCloud.new( "name", "password", API_URL ) do |client|
+      client.driver_name.should eql( 'mock' )
+    end
+  end
+
+  it "should provide the current driver name without client" do
+    DeltaCloud.driver_name( API_URL ).should eql( 'mock' )
+  end
+
+  describe "without a block" do
+    before( :each ) do
+      reload_fixtures
+    end
+    it "should connect without a block" do
+      client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+      client.images.should_not be_nil
+    end
+  end
+
+end
diff --git a/client/tests/content_negotiation_tests.rb b/client/tests/content_negotiation_tests.rb
new file mode 100644
index 0000000..ffd222c
--- /dev/null
+++ b/client/tests/content_negotiation_tests.rb
@@ -0,0 +1,137 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+def client
+  RestClient::Resource.new(API_URL)
+end
+
+def headers(header)
+  encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
+  { :authorization => "Basic " + encoded_credentials }.merge(header)
+end
+
+describe "return JSON" do
+
+  it 'should return JSON when using application/json, */*' do
+    header_hash = {
+      # FIXME: There is a bug in rack-accept that cause to respond with HTML
+      # to the configuration below.
+      #
+      # 'Accept' => "application/json, */*"
+      'Accept' => "application/json"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/json/
+    end
+  end
+
+  it 'should return JSON when using just application/json' do
+    header_hash = {
+      'Accept' => "application/json"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/json/
+    end
+  end
+
+end
+
+describe "return HTML in different browsers" do
+
+  it "wants XML using format parameter" do
+    client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "raise 406 error on wrong accept" do
+    client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
+      response.code.should == 406
+    end
+  end
+
+  it "wants HTML using format parameter and accept set to XML" do
+    client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+#  FIXME: This return 406 for some reason on GIT sinatra
+#  it "wants a PNG image" do 
+#    client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
+#      response.code.should == 200
+#      response.headers[:content_type].should =~ /^image\/png/
+#    end
+#  end
+
+  it "doesn't have accept header" do
+    client.get('Accept' => '') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "can handle unknown formats" do
+    client.get('Accept' => 'format/unknown') do |response, request, &block|
+      response.code.should == 406
+    end
+  end
+
+  it "wants explicitly XML" do
+    client.get('Accept' => 'application/xml') do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^application\/xml/
+    end
+  end
+
+  it "Internet Explorer" do
+    header_hash = {
+      'Accept' => "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*",
+      'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+  it "Mozilla Firefox" do
+    client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+  it "Opera" do
+    header_hash = { 
+      'Accept' => "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
+      'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
+    }
+    client.get(header_hash) do |response, request, &block|
+      response.code.should == 200
+      response.headers[:content_type].should =~ /^text\/html/
+    end
+  end
+
+end
diff --git a/client/tests/errors_test.rb b/client/tests/errors_test.rb
new file mode 100644
index 0000000..031e3b7
--- /dev/null
+++ b/client/tests/errors_test.rb
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+describe "server error handler" do
+
+  it_should_behave_like "all resources"
+
+  it 'should capture HTTP 500 error as DeltacloudError' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
+    end
+  end
+
+  it 'should capture HTTP 502 error as ProviderError' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
+    end
+  end
+
+  it 'should capture HTTP 501 error as NotImplemented' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
+    end
+  end
+
+  it 'should capture HTTP 504 error as ProviderTimeout' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
+    end
+  end
+
+end
+
+describe "client error handler" do
+
+  it 'should capture HTTP 404 error as NotFound' do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    end
+  end
+
+end
diff --git a/client/tests/hardware_profiles_test.rb b/client/tests/hardware_profiles_test.rb
new file mode 100644
index 0000000..59bfae0
--- /dev/null
+++ b/client/tests/hardware_profiles_test.rb
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+def prop_check(prop, value_class)
+  if prop.present?
+    prop.value.should_not be_nil
+    prop.value.should be_a(value_class)
+  end
+end
+
+describe "hardware_profiles" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all hardware profiles" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        hardware_profiles = client.hardware_profiles
+        hardware_profiles.should_not be_empty
+        hardware_profiles.each do |hwp|
+          hwp.uri.should_not be_nil
+          hwp.uri.should be_a(String)
+          prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
+       end
+      end
+    end
+  end
+
+  it "should allow filtering of hardware_profiles by architecture" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hardware_profiles = client.hardware_profiles( :architecture=>'i386' )
+      hardware_profiles.should_not be_empty
+      hardware_profiles.size.should eql( 2 )
+      hardware_profiles.first.architecture.value.should eql( 'i386' )
+    end
+  end
+
+  it "should allow fetching a hardware_profile by id" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hwp = client.hardware_profile( 'm1-small' )
+      hwp.should_not be_nil
+      hwp.id.should eql( 'm1-small' )
+    end
+  end
+
+  it "should allow fetching different hardware_profiles" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    hwp1 = client.hardware_profile( 'm1-small' )
+    hwp2 = client.hardware_profile( 'm1-large' )
+    hwp1.storage.value.should_not eql(hwp2.storage.value)
+    hwp1.memory.value.should_not eql(hwp2.memory.value)
+  end
+
+  it "should allow fetching a hardware_profile by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hwp = client.fetch_hardware_profile( API_URL + '/hardware_profiles/m1-small' )
+      hwp.should_not be_nil
+      hwp.id.should eql( 'm1-small' )
+    end
+  end
+
+end
diff --git a/client/tests/images_test.rb b/client/tests/images_test.rb
new file mode 100644
index 0000000..3b209cd
--- /dev/null
+++ b/client/tests/images_test.rb
@@ -0,0 +1,107 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+describe "images" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all images" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        images = client.images
+        images.should_not be_empty
+        images.size.should eql( 3 )
+        images.each do |image|
+          image.uri.should_not be_nil
+          image.uri.should be_a(String)
+          image.description.should_not be_nil
+          image.description.should be_a(String)
+          image.architecture.should_not be_nil
+          image.architecture.should be_a(String)
+          image.owner_id.should_not be_nil
+          image.owner_id.should be_a(String)
+        end
+      end
+    end
+  end
+
+  it "should allow retrieval of my own images" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      images = client.images( :owner_id=>:self )
+      images.should_not be_empty
+      images.size.should eql( 1 )
+      images.each do |image|
+        image.uri.should_not be_nil
+        image.uri.should be_a(String)
+        image.description.should_not be_nil
+        image.description.should be_a(String)
+        image.architecture.should_not be_nil
+        image.architecture.should be_a(String)
+        image.owner_id.should_not be_nil
+        image.owner_id.should be_a(String)
+      end
+    end
+  end
+
+  it "should allow retrieval of a single image by ID" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      image = client.image( 'img1' )
+      image.should_not be_nil
+      image.uri.should eql( API_URL + '/images/img1' )
+      image.id.should eql( 'img1' )
+      image.architecture.should eql( 'x86_64' )
+    end
+  end
+
+  it "should allow retrieval of a single image by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      image = client.fetch_image( API_URL + '/images/img1' )
+      image.should_not be_nil
+      image.uri.should eql( API_URL + '/images/img1' )
+      image.id.should eql( 'img1' )
+      image.architecture.should eql( 'x86_64' )
+    end
+  end
+
+  describe "filtering by architecture" do
+    it "return matching images" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        images = client.images( :architecture=>'x86_64' )
+        images.should_not be_empty
+        images.each do |image|
+          image.architecture.should eql( 'x86_64' )
+        end
+        images = client.images( :architecture=>'i386' )
+        images.should_not be_empty
+        images.each do |image|
+          image.architecture.should eql( 'i386' )
+        end
+      end
+    end
+
+    it "should return an empty array for no matches" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        images = client.images( :architecture=>'8088' )
+        images.should be_empty
+      end
+    end
+  end
+end
diff --git a/client/tests/instance_states_test.rb b/client/tests/instance_states_test.rb
new file mode 100644
index 0000000..c79c273
--- /dev/null
+++ b/client/tests/instance_states_test.rb
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+=begin
+Spec::Matchers.define :include_transition do |action,to|
+  match do |transitions|
+    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
+    ! found.nil?
+  end
+end
+=end
+
+describe "instance-states" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of instance-state information" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        instance_states = client.instance_states
+        instance_states.should_not be_nil
+        instance_states.should_not be_empty
+
+        instance_states[0].name.should eql( 'start' )
+        instance_states[0].transitions.size.should eql( 1 )
+        instance_states[0].transitions[0].should_not be_auto
+
+        instance_states[1].name.should eql( 'pending' )
+        instance_states[1].transitions.size.should eql( 1 )
+        instance_states[1].transitions[0].should be_auto
+
+        instance_states[2].name.should eql( 'running' )
+        instance_states[2].transitions.size.should eql( 2 )
+        includes_transition( instance_states[2].transitions, :reboot, :running ).should be_true
+        includes_transition( instance_states[2].transitions, :stop, :stopped ).should be_true
+      end
+    end
+  end
+
+  it "should allow retrieval of a single instance-state blob" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance_state = client.instance_state( :pending )
+      instance_state.should_not be_nil
+      instance_state.name.should eql( 'pending' )
+      instance_state.transitions.size.should eql( 1 )
+      instance_state.transitions[0].should be_auto
+
+      instance_state = client.instance_state( :running )
+      instance_state.name.should eql( 'running' )
+      instance_state.transitions.size.should eql( 2 )
+      includes_transition( instance_state.transitions, :reboot, :running ).should be_true
+      includes_transition( instance_state.transitions, :stop, :stopped ).should be_true
+    end
+  end
+
+  def includes_transition( transitions, action, to )
+    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
+    ! found.nil?
+  end
+
+
+end
diff --git a/client/tests/instances_test.rb b/client/tests/instances_test.rb
new file mode 100644
index 0000000..f7fc7e7
--- /dev/null
+++ b/client/tests/instances_test.rb
@@ -0,0 +1,210 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+describe "instances" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all instances" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        instances = client.instances
+        instances.should_not be_empty
+        instances.each do |instance|
+          instance.uri.should_not be_nil
+          instance.uri.should be_a( String )
+          instance.owner_id.should_not be_nil
+          instance.owner_id.should be_a( String )
+          instance.image.should_not be_nil
+          instance.image.to_s.should match(/DeltaCloud::API::.*::Image/)
+          instance.hardware_profile.should_not be_nil
+          instance.hardware_profile.should be_a( DeltaCloud::API::Base::HardwareProfile )
+          instance.state.should_not be_nil
+          instance.state.should be_a( String )
+          instance.public_addresses.should_not be_nil
+          instance.public_addresses.should_not be_empty
+          instance.public_addresses.should be_a( Array )
+          instance.private_addresses.should_not be_nil
+          instance.private_addresses.should_not be_empty
+          instance.private_addresses.should be_a( Array )
+        end
+      end
+    end
+  end
+
+  it "should allow navigation from instance to image" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instances = client.instances
+      instances.should_not be_empty
+      instance = instances.first
+      instance.image.should_not be_nil
+      instance.image.description.should_not be_nil
+      instance.image.description.should be_a(String)
+    end
+  end
+
+  it "should allow retrieval of a single instance" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.instance( "inst0" )
+      instance.should_not be_nil
+      instance.name.should_not be_nil
+      instance.name.should eql( 'Mock Instance With Profile Change' )
+      instance.uri.should_not be_nil
+      instance.uri.should be_a( String )
+      instance.owner_id.should eql( "mockuser" )
+      instance.public_addresses.first.class.should eql(Hash)
+      instance.public_addresses.first[:type].should eql('hostname')
+      instance.public_addresses.first[:address].should eql('img1.inst0.public.com')
+      instance.image.should_not be_nil
+      instance.image.uri.should eql( API_URL + "/images/img1" )
+      instance.hardware_profile.should_not be_nil
+      instance.hardware_profile.should_not be_nil
+      instance.hardware_profile.uri.should eql( API_URL + "/hardware_profiles/m1-large" )
+      instance.hardware_profile.memory.value.should eql('10240')
+      instance.hardware_profile.storage.value.should eql('850')
+      instance.state.should eql( "RUNNING" )
+      instance.actions.should_not be_nil
+    end
+  end
+
+  it "should allow creation of new instances with reasonable defaults" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.create_instance( 'img1', :name=>'TestInstance', :hardware_profile => 'm1-large' )
+      instance.should_not be_nil
+      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
+      instance.id.should match( /inst[0-9]+/ )
+      instance.name.should eql( 'TestInstance' )
+      instance.image.id.should eql( 'img1' )
+      instance.hardware_profile.id.should eql( 'm1-large' )
+      instance.realm.id.should eql( 'us' )
+    end
+  end
+
+  it "should allow creation of new instances with specific realm" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.create_instance( 'img1', :realm=>'eu', :hardware_profile => 'm1-large' )
+      instance.should_not be_nil
+      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
+      instance.id.should match( /inst[0-9]+/ )
+      instance.image.id.should eql( 'img1' )
+      instance.hardware_profile.id.should eql( 'm1-large' )
+      instance.realm.id.should eql( 'eu' )
+    end
+  end
+
+  it "should allow creation of new instances with specific hardware profile" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.create_instance( 'img1',
+                                         :hardware_profile=>'m1-xlarge' )
+      instance.should_not be_nil
+      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
+      instance.id.should match( /inst[0-9]+/ )
+      instance.image.id.should eql( 'img1' )
+      instance.hardware_profile.id.should eql( 'm1-xlarge' )
+      instance.realm.id.should eql( 'us' )
+    end
+  end
+
+  it "should allow creation of new instances with specific hardware profile overriding memory" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      hwp = { :id => 'm1-xlarge', :memory => 32768 }
+      instance = client.create_instance( 'img1', :hardware_profile=> hwp )
+      instance.should_not be_nil
+      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
+      instance.id.should match( /inst[0-9]+/ )
+      instance.image.id.should eql( 'img1' )
+      instance.hardware_profile.id.should eql( 'm1-xlarge' )
+      instance.hardware_profile.memory.value.should eql('12288')
+      instance.realm.id.should eql( 'us' )
+    end
+  end
+
+  it "should allow creation of new instances with specific realm and hardware profile" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.create_instance( 'img1', :realm=>'eu',
+                                         :hardware_profile=>'m1-xlarge' )
+      instance.should_not be_nil
+      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
+      instance.id.should match( /inst[0-9]+/ )
+      instance.image.id.should eql( 'img1' )
+      instance.hardware_profile.id.should eql( 'm1-xlarge' )
+      instance.realm.id.should eql( 'eu' )
+    end
+  end
+
+  it "should allow fetching of instances by id" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.instance( 'inst1' )
+      instance.should_not be_nil
+      instance.uri.should_not be_nil
+      instance.uri.should be_a( String )
+    end
+  end
+
+  it "should allow fetching of instances by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      instance = client.fetch_instance( API_URL + '/instances/inst1' )
+      instance.should_not be_nil
+      instance.uri.should eql( API_URL + '/instances/inst1' )
+      instance.id.should eql( 'inst1' )
+    end
+  end
+
+  describe "performing actions on instances" do
+    it "should allow actions that are valid" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        instance = client.instance( 'inst1' )
+        instance.should_not be_nil
+        instance.state.should eql( "RUNNING" )
+        instance.uri.should eql( API_URL + '/instances/inst1' )
+        instance.id.should eql( 'inst1' )
+        instance.stop!
+        instance.state.should eql( "STOPPED" )
+        instance.start!
+        instance.state.should eql( "RUNNING" )
+      end
+    end
+
+    it "should not allow actions that are invalid" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        instance = client.instance( 'inst1' )
+        instance.should_not be_nil
+        unless instance.state.eql?("RUNNING")
+          instance.start!
+        end
+        instance.state.should eql( "RUNNING" )
+        lambda{instance.start!}.should raise_error
+      end
+    end
+
+    it "should not throw exception when destroying an instance" do
+      DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+        instance = client.create_instance( 'img1',
+                                           :name=>'TestDestroyInstance',
+                                           :hardware_profile => 'm1-xlarge' )
+        instance.stop!
+        lambda {
+          instance.destroy!
+        }.should_not raise_error
+      end
+    end
+  end
+end
diff --git a/client/tests/keys_tests.rb b/client/tests/keys_tests.rb
new file mode 100644
index 0000000..fa2ff54
--- /dev/null
+++ b/client/tests/keys_tests.rb
@@ -0,0 +1,97 @@
+#
+# Copyright (C) 2009-2011  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+def check_key(the_key, key_name = "")
+  the_key.should_not be_nil
+  the_key.id.should be_a(String)
+  the_key.id.should eql(key_name)
+  the_key.actions.should_not be_nil
+  the_key.actions.size.should eql(1)
+  the_key.actions.first[0].should eql("destroy")
+  the_key.actions.first[1].should eql("#{API_URL}/keys/#{key_name}")
+  the_key.fingerprint.should_not be_nil
+  the_key.fingerprint.should be_a(String)
+  the_key.pem.should_not be_nil
+  the_key.pem.first.should be_a(String)
+end
+
+def create_key_if_necessary(client, key_name)
+  the_key = client.key(key_name)
+  unless the_key
+    client.create_key()
+  end
+end
+
+
+describe "keys" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all keys" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        lambda{
+              client.keys
+              }.should_not raise_error
+      end
+    end
+  end
+end
+
+describe "operations on keys" do
+
+  it "should allow successful creation of a new key" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      new_key = client.create_key({:name => "my_new_key"})
+      check_key(new_key, "my_new_key")
+    end
+  end
+
+  it "should allow retrieval of an existing named key" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      key_name = "my_new_key"
+      create_key_if_necessary(client, key_name)
+      the_key = client.key(key_name)
+      check_key(the_key, key_name)
+    end
+  end
+
+  it "should raise error if you create a key with the same name as an existing key" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      name = "my_new_key"
+      create_key_if_necessary(client, name)
+      lambda{
+              client.create_key({:name => name})
+            }.should raise_error
+    end
+  end
+
+  it "should allow successful destruction of an existing key" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      name = "my_new_key"
+      create_key_if_necessary(client, name)
+      the_key = client.key(name)
+      lambda{
+              the_key.destroy!
+            }.should_not raise_error
+    end
+  end
+
+end
diff --git a/client/tests/realms_test.rb b/client/tests/realms_test.rb
new file mode 100644
index 0000000..241fb5c
--- /dev/null
+++ b/client/tests/realms_test.rb
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+require 'specs/spec_helper'
+
+describe "realms" do
+
+  it_should_behave_like "all resources"
+
+  it "should allow retrieval of all realms" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
+        realms = client.realms
+        realms.should_not be_empty
+        realms.each do |realm|
+          realm.uri.should_not be_nil
+          realm.uri.should be_a(String)
+          realm.id.should_not be_nil
+          realm.id.should be_a(String)
+          realm.name.should_not be_nil
+          realm.name.should be_a(String)
+        end
+      end
+    end
+  end
+
+
+  it "should allow fetching a realm by id" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      realm = client.realm( 'us' )
+      realm.should_not be_nil
+      realm.id.should eql( 'us' )
+      realm.name.should eql( 'United States' )
+      realm.state.should eql( 'AVAILABLE' )
+      realm = client.realm( 'eu' )
+      realm.should_not be_nil
+      realm.id.should eql( 'eu' )
+      realm.name.should eql( 'Europe' )
+      realm.state.should eql( 'AVAILABLE' )
+    end
+  end
+
+  it "should allow fetching a realm by URI" do
+    DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+      realm = client.fetch_realm( API_URL + '/realms/us' )
+      realm.should_not be_nil
+      realm.id.should eql( 'us' )
+    end
+  end
+
+end
diff --git a/client/tests/storage_snapshot_test.rb b/client/tests/storage_snapshot_test.rb
new file mode 100644
index 0000000..94f149c
--- /dev/null
+++ b/client/tests/storage_snapshot_test.rb
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+describe "storage snapshot" do
+
+  it_should_behave_like "all resources"
+
+  it "allow retrieval of all storage volumes owned by the current user" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
+      client.connect do |client|
+        storage_snapshots = client.storage_snapshots
+        storage_snapshots.should_not be_nil
+        storage_snapshots.should_not be_empty
+        ids = storage_snapshots.collect{|e| e.id}
+        ids.size.should eql( 3 )
+        ids.should include( 'snap2' )
+        ids.should include( 'snap3' )
+      end
+    end
+  end
+
+  it "should allow fetching of storage volume by id" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.connect do |client|
+      storage_snapshot = client.storage_snapshot( 'snap2' )
+      storage_snapshot.should_not be_nil
+      storage_snapshot.id.should eql( 'snap2' )
+      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
+      storage_snapshot.storage_volume.id.should eql( 'vol2' )
+    end
+  end
+
+  it "should allow fetching of storage volume by URI"  do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.connect do |client|
+      storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
+      storage_snapshot.should_not be_nil
+      storage_snapshot.id.should eql( 'snap2' )
+      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
+      storage_snapshot.storage_volume.id.should eql( 'vol2' )
+    end
+  end
+
+  it "should return nil for unknown storage volume by ID" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    lambda {
+      client.connect do |client|
+        client.storage_snapshot( "bogus" )
+      end
+    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+  end
+
+  it "should return nil for unknown storage volume by URI" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    lambda {
+      client.connect do |client|
+        client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
+      end
+    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+  end
+
+end
diff --git a/client/tests/storage_volume_test.rb b/client/tests/storage_volume_test.rb
new file mode 100644
index 0000000..8fb153e
--- /dev/null
+++ b/client/tests/storage_volume_test.rb
@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2009  Red Hat, Inc.
+#
+# 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.
+
+
+require 'specs/spec_helper'
+
+describe "storage volumes" do
+
+  it_should_behave_like "all resources"
+
+  it "allow retrieval of all storage volumes owned by the current user" do
+    [API_URL, API_URL_REDIRECT].each do |entry_point|
+      client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
+      client.connect do |client|
+        storage_volumes = client.storage_volumes
+        storage_volumes.should_not be_nil
+        storage_volumes.should_not be_empty
+        ids = storage_volumes.collect{|e| e.id}
+        ids.size.should eql( 3 )
+        ids.should include( 'vol2' )
+        ids.should include( 'vol3' )
+      end
+    end
+  end
+
+  it "should allow fetching of storage volume by id" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.connect do |client|
+      storage_volume = client.storage_volume( 'vol3' )
+      storage_volume.id.should eql( 'vol3' )
+      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
+      storage_volume.capacity.should eql( 1.0 )
+      storage_volume.device.should eql( '/dev/sda1' )
+      storage_volume.instance.should_not be_nil
+      storage_volume.instance.id.should eql( 'inst1' )
+      ip = storage_volume.instance
+      ip.hardware_profile.architecture.value.should eql( 'i386' )
+    end
+  end
+
+  it "should allow fetching of storage volume by URI" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    client.connect do |client|
+      storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
+      storage_volume.should_not be_nil
+      storage_volume.id.should eql( 'vol3' )
+      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
+      storage_volume.capacity.should eql( 1.0 )
+      storage_volume.device.should eql( '/dev/sda1' )
+      storage_volume.instance.should_not be_nil
+      storage_volume.instance.id.should eql( 'inst1' )
+      ip = storage_volume.instance
+      ip.hardware_profile.architecture.value.should eql( 'i386' )
+    end
+  end
+
+  it "should raise exception for unknown storage volume by ID" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    lambda {
+      client.connect do |client|
+        client.storage_volume( 'bogus' )
+      end
+    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+  end
+
+  it "should raise exception for unknown storage volume by URI" do
+    client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+    lambda {
+      client.connect do |client|
+        client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
+      end
+    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+  end
+
+
+end
-- 
1.7.10.2


[PATCH core 3/6] Client: Replaced ambiguous 'require' with require_relative

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* The 'require' was used in weird way that broke MRI 1.9
  compatibility.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/lib/base_object.rb |    2 +-
 client/lib/deltacloud.rb  |   15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index 5f63b5d..5035266 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -13,7 +13,7 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'string'
+require_relative './string.rb'
 
 module DeltaCloud
 
diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index 35fe86d..7caae95 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -17,12 +17,13 @@ require 'nokogiri'
 require 'rest_client'
 require 'base64'
 require 'logger'
-require 'hwp_properties'
-require 'instance_state'
-require 'documentation'
-require 'base_object'
-require 'errors'
-require 'client_bucket_methods'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
+require_relative './hwp_properties.rb'
+require_relative './instance_state.rb'
+require_relative './documentation.rb'
+require_relative './base_object.rb'
+require_relative './errors.rb'
+require_relative './client_bucket_methods.rb'
 
 module DeltaCloud
 
@@ -146,7 +147,7 @@ module DeltaCloud
           end
 
           define_method :"fetch_#{model.to_s.singularize}" do |url|
-            id = url.grep(/\/#{model}\/(.*)$/)
+            url =~ /\/#{model}\/(.*)$/
             self.send(model.to_s.singularize.to_sym, $1)
           end
 
-- 
1.7.10.2


[PATCH core 5/6] Core: Minor fixes to base_driver and euca driver

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* Removed unused local vars
* Wiped whitespace

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/base_driver.rb                  |    3 +--
 server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index 21e4382..6687a24 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -75,7 +75,7 @@ module Deltacloud
       return if hw_profile
       hw_profile = ::Deltacloud::HardwareProfile.new( name, &block )
       @hardware_profiles << hw_profile
-      hw_params = hw_profile.params
+      hw_profile.params
       # FIXME: Features
       #unless hw_params.empty?
       #  feature :instances, :hardware_profiles do
@@ -145,7 +145,6 @@ module Deltacloud
 
     def instance_actions_for(state)
       actions = []
-      state_key = state.downcase.to_sym
       states = instance_state_machine.states()
       current_state = states.find{|e| e.name == state.underscore.to_sym }
       if ( current_state )
diff --git a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
index b87a026..7586052 100644
--- a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
+++ b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
@@ -71,7 +71,7 @@ module Deltacloud
         end
 
         def default_image_owner
-          "self" 
+          "self"
         end
 
         def default_image_type
-- 
1.7.10.2


[PATCH core 6/6] Client: Converted RSpec tests to Minitest

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/tests/buckets_test.rb              |  104 ++++++++--------
 client/tests/client_test.rb               |   34 +++---
 client/tests/content_negotiation_tests.rb |   57 ++++-----
 client/tests/errors_test.rb               |   17 +--
 client/tests/hardware_profiles_test.rb    |   36 +++---
 client/tests/images_test.rb               |   74 ++++++------
 client/tests/instance_states_test.rb      |   57 ++++-----
 client/tests/instances_test.rb            |  184 ++++++++++++++---------------
 client/tests/keys_tests.rb                |   44 ++++---
 client/tests/realms_test.rb               |   53 +++++----
 client/tests/storage_snapshot_test.rb     |   58 ++++-----
 client/tests/storage_volume_test.rb       |   70 +++++------
 client/tests/test_helper.rb               |   17 +++
 13 files changed, 400 insertions(+), 405 deletions(-)
 create mode 100644 client/tests/test_helper.rb

diff --git a/client/tests/buckets_test.rb b/client/tests/buckets_test.rb
index b897e0c..32037cd 100644
--- a/client/tests/buckets_test.rb
+++ b/client/tests/buckets_test.rb
@@ -16,22 +16,23 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-describe "buckets" do
+require_relative './test_helper.rb'
 
-  it_should_behave_like "all resources"
+describe "Buckets" do
 
   it "should allow retrieval of all buckets" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
         buckets = client.buckets
-        buckets.should_not be_empty
+        buckets.wont_be_empty
         buckets.each do |bucket|
-          bucket.uri.should_not be_nil
-          bucket.uri.should be_a( String )
-          bucket.name.should_not be_nil
-          bucket.name.should be_a(String)
+          bucket.uri.wont_be_nil
+          bucket.uri.must_be_kind_of String
+          bucket.name.wont_be_nil
+          bucket.name.must_be_kind_of String
         end
       end
     end
@@ -40,13 +41,13 @@ describe "buckets" do
   it "should allow retrieval of a named bucket" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
-      bucket.uri.should eql(API_URL + "/buckets/bucket1")
-      bucket.size.should eql(3.0)
-      bucket.name.should_not be_nil
-      bucket.name.should be_a(String)
+      bucket.wont_be_nil
+      bucket.uri.must_equal API_URL + "/buckets/bucket1"
+      bucket.size.must_equal 3.0
+      bucket.name.wont_be_nil
+      bucket.name.must_be_kind_of String
       blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
+      blob_list.size.must_equal bucket.size.to_i
     end
   end
 
@@ -57,30 +58,28 @@ describe "Operations on buckets" do
   it "should allow creation of a new bucket" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       new_bucket = client.create_bucket({'id' => "my_new_bucket"})
-      new_bucket.should_not be_nil
-      new_bucket.uri.should eql(API_URL + "/buckets/my_new_bucket")
-      new_bucket.name.should_not be_nil
-      new_bucket.name.should be_a(String)
-      new_bucket.name.should eql("my_new_bucket")
+      new_bucket.wont_be_nil
+      new_bucket.uri.must_equal API_URL + "/buckets/my_new_bucket"
+      new_bucket.name.wont_be_nil
+      new_bucket.name.must_be_kind_of String
+      new_bucket.name.must_equal "my_new_bucket"
     end
   end
 
   it "should allow deletion of an existing bucket" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       new_bucket = client.bucket("my_new_bucket")
-      new_bucket.should_not be_nil
-      new_bucket.name.should eql("my_new_bucket")
-      lambda{
-              client.destroy_bucket({'id' => "my_new_bucket"})
-            }.should_not raise_error
+      new_bucket.wont_be_nil
+      new_bucket.name.must_equal "my_new_bucket"
+      client.destroy_bucket('id' => "my_new_bucket").must_be_nil
     end
   end
 
   it "should throw error if you delete a non existing bucket" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_bucket({'id' => "i_dont_exist"})
-            }.should raise_error
+      lambda {
+      client.destroy_bucket({'id' => "i_dont_exist"}).must_be_nil
+      }.must_raise DeltaCloud::HTTPError::DeltacloudError
     end
   end
 
@@ -91,21 +90,20 @@ describe "Blobs" do
   it "should allow retrieval of a bucket's blobs" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       bucket = client.bucket("bucket1")
-      bucket.should_not be_nil
+      bucket.wont_be_nil
       blob_list = bucket.blob_list.split(", ")
-      blob_list.size.should eql(bucket.size.to_i)
+      blob_list.size.must_equal bucket.size.to_i
       blob_list.each do |b_id|
-        blob = client.blob({"bucket" => bucket.name, :id => b_id})
-        puts blob.inspect
-        blob.bucket.should_not be_nil
-        blob.bucket.should be_a(String)
-        blob.bucket.should eql(bucket.name)
-        blob.content_length.should_not be_nil
-        blob.content_length.should be_a(Float)
-        blob.content_length.should >= 0
-        blob_data = client.blob_data({"bucket" => bucket.name, :id => b_id})
-        blob_data.size.to_f.should == blob.content_length
-        blob.last_modified.should_not be_nil
+        blob = client.blob("bucket" => bucket.name, :id => b_id)
+        blob.bucket.wont_be_nil
+        blob.bucket.must_be_kind_of String
+        blob.bucket.must_equal bucket.name
+        blob.content_length.wont_be_nil
+        blob.content_length.must_be_kind_of Float
+        blob.content_length.must_be :'>=', 0
+        blob_data = client.blob_data("bucket" => bucket.name, :id => b_id)
+        blob_data.size.to_f.must_equal blob.content_length
+        blob.last_modified.wont_be_nil
       end
     end
   end
@@ -117,32 +115,32 @@ describe "Operations on blobs" do
   it "should successfully create a new blob" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       blob_data = File.new("./blob_data_file", "w+")
-
       blob_data.write("this is some blob data \n")
       blob_data.rewind
-      some_new_blob = client.create_blob({:id => "some_new_blob",
-                          'bucket' => "bucket1",
-                          'file_path' => blob_data.path})
-      some_new_blob.should_not be_nil
-      some_new_blob.content_length.should_not be_nil
-      some_new_blob.content_length.should eql(24.0)
+      some_new_blob = client.create_blob(
+        :id => "some_new_blob",
+        'bucket' => "bucket1",
+        'file_path' => blob_data.path
+      )
+      some_new_blob.wont_be_nil
+      some_new_blob.content_length.wont_be_nil
+      some_new_blob.content_length.must_equal 24.0
       File.delete(blob_data.path)
     end
   end
 
   it "should allow deletion of an existing blob" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"some_new_blob", 'bucket'=>"bucket1"})
-            }.should_not raise_error
+      client.destroy_blob(:id=>"some_new_blob", 'bucket'=>"bucket1").must_be_nil
     end
   end
 
   it "should throw error if you delete a non existing blob" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      lambda{
-              client.destroy_blob({:id=>"no_such_blob", 'bucket'=>"bucket1"})
-            }.should raise_error
+      lambda {
+        client.destroy_blob(:id=>"no_such_blob", 'bucket'=>"bucket1").must_be_nil
+      }.must_raise DeltaCloud::HTTPError::DeltacloudError
     end
   end
+
 end
diff --git a/client/tests/client_test.rb b/client/tests/client_test.rb
index b4c1a75..29fab42 100644
--- a/client/tests/client_test.rb
+++ b/client/tests/client_test.rb
@@ -16,48 +16,48 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
+
+require_relative './test_helper.rb'
 
 describe "initializing the client" do
 
   it "should parse valid API URIs" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.api_host.should eql( API_HOST )
-    client.api_port.should eql( API_PORT.to_i )
-    client.api_path.should eql( API_PATH )
+    client.api_host.must_equal API_HOST
+    client.api_port.must_equal API_PORT.to_i
+    client.api_path.must_equal API_PATH
   end
 
   it "should discover entry points upon connection" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( "name", "password", entry_point ) do |client|
-        client.entry_points[:hardware_profiles].should eql( "#{API_URL}/hardware_profiles" )
-        client.entry_points[:images].should            eql( "#{API_URL}/images" )
-        client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
-        client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage_volumes" )
-        client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage_snapshots" )
-        client.entry_points[:buckets].should           eql( "#{API_URL}/buckets")
-        client.entry_points[:keys].should              eql( "#{API_URL}/keys")
+        client.entry_points[:hardware_profiles].must_equal "#{API_URL}/hardware_profiles"
+        client.entry_points[:images].must_equal "#{API_URL}/images"
+        client.entry_points[:instances].must_equal "#{API_URL}/instances"
+        client.entry_points[:storage_volumes].must_equal "#{API_URL}/storage_volumes"
+        client.entry_points[:storage_snapshots].must_equal "#{API_URL}/storage_snapshots"
+        client.entry_points[:buckets].must_equal "#{API_URL}/buckets"
+        client.entry_points[:keys].must_equal "#{API_URL}/keys"
       end
     end
   end
 
   it "should provide the current driver name via client" do
     DeltaCloud.new( "name", "password", API_URL ) do |client|
-      client.driver_name.should eql( 'mock' )
+      client.driver_name.must_equal 'mock'
     end
   end
 
   it "should provide the current driver name without client" do
-    DeltaCloud.driver_name( API_URL ).should eql( 'mock' )
+    DeltaCloud.driver_name( API_URL ).must_equal 'mock'
   end
 
   describe "without a block" do
-    before( :each ) do
-      reload_fixtures
-    end
     it "should connect without a block" do
       client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-      client.images.should_not be_nil
+      client.images.wont_be_nil
     end
   end
 
diff --git a/client/tests/content_negotiation_tests.rb b/client/tests/content_negotiation_tests.rb
index ffd222c..d963027 100644
--- a/client/tests/content_negotiation_tests.rb
+++ b/client/tests/content_negotiation_tests.rb
@@ -16,11 +16,12 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-def client
-  RestClient::Resource.new(API_URL)
-end
+require_relative './test_helper.rb'
+
+def client; RestClient::Resource.new(API_URL); end
 
 def headers(header)
   encoded_credentials = ["#{API_NAME}:#{API_PASSWORD}"].pack("m0").gsub(/\n/,'')
@@ -38,8 +39,8 @@ describe "return JSON" do
       'Accept' => "application/json"
     }
     client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^application\/json/
     end
   end
 
@@ -48,8 +49,8 @@ describe "return JSON" do
       'Accept' => "application/json"
     }
     client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/json/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^application\/json/
     end
   end
 
@@ -59,49 +60,41 @@ describe "return HTML in different browsers" do
 
   it "wants XML using format parameter" do
     client.get(:params => { 'format' => 'xml' }, 'Accept' => 'application/xhtml+xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^application\/xml/
     end
   end
 
   it "raise 406 error on wrong accept" do
     client['hardware_profiles'].get('Accept' => 'image/png;q=1') do |response, request, &block|
-      response.code.should == 406
+      response.code.must_equal 406
     end
   end
 
   it "wants HTML using format parameter and accept set to XML" do
     client.get(:params => { 'format' => 'html'}, 'Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^text\/html/
     end
   end
 
-#  FIXME: This return 406 for some reason on GIT sinatra
-#  it "wants a PNG image" do 
-#    client['instance_states'].get('Accept' => 'image/png') do |response, request, &block|
-#      response.code.should == 200
-#      response.headers[:content_type].should =~ /^image\/png/
-#    end
-#  end
-
   it "doesn't have accept header" do
     client.get('Accept' => '') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^application\/xml/
     end
   end
 
   it "can handle unknown formats" do
     client.get('Accept' => 'format/unknown') do |response, request, &block|
-      response.code.should == 406
+      response.code.must_equal 406
     end
   end
 
   it "wants explicitly XML" do
     client.get('Accept' => 'application/xml') do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^application\/xml/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^application\/xml/
     end
   end
 
@@ -111,15 +104,15 @@ describe "return HTML in different browsers" do
       'User-agent' => "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)"
     }
     client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^text\/html/
     end
   end
 
   it "Mozilla Firefox" do
     client.get('Accept' => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^text\/html/
     end
   end
 
@@ -129,8 +122,8 @@ describe "return HTML in different browsers" do
       'User-agent' => "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11"
     }
     client.get(header_hash) do |response, request, &block|
-      response.code.should == 200
-      response.headers[:content_type].should =~ /^text\/html/
+      response.code.must_equal 200
+      response.headers[:content_type].must_match /^text\/html/
     end
   end
 
diff --git a/client/tests/errors_test.rb b/client/tests/errors_test.rb
index 031e3b7..12c6c21 100644
--- a/client/tests/errors_test.rb
+++ b/client/tests/errors_test.rb
@@ -16,33 +16,34 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-describe "server error handler" do
+require_relative './test_helper.rb'
 
-  it_should_behave_like "all resources"
+describe "server error handler" do
 
   it 'should capture HTTP 500 error as DeltacloudError' do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('500') }.should raise_error(DeltaCloud::HTTPError::DeltacloudError)
+      lambda { client.realm('500') }.must_raise DeltaCloud::HTTPError::DeltacloudError
     end
   end
 
   it 'should capture HTTP 502 error as ProviderError' do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('502') }.should raise_error(DeltaCloud::HTTPError::ProviderError)
+      lambda { client.realm('502') }.must_raise DeltaCloud::HTTPError::ProviderError
     end
   end
 
   it 'should capture HTTP 501 error as NotImplemented' do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('501') }.should raise_error(DeltaCloud::HTTPError::NotImplemented)
+      lambda { client.realm('501') }.must_raise DeltaCloud::HTTPError::NotImplemented
     end
   end
 
   it 'should capture HTTP 504 error as ProviderTimeout' do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('504') }.should raise_error(DeltaCloud::HTTPError::ProviderTimeout)
+      lambda { client.realm('504') }.must_raise DeltaCloud::HTTPError::ProviderTimeout
     end
   end
 
@@ -52,7 +53,7 @@ describe "client error handler" do
 
   it 'should capture HTTP 404 error as NotFound' do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
-      expect { client.realm('non-existing-realm') }.should raise_error(DeltaCloud::HTTPError::NotFound)
+      lambda { client.realm('non-existing-realm') }.must_raise DeltaCloud::HTTPError::NotFound
     end
   end
 
diff --git a/client/tests/hardware_profiles_test.rb b/client/tests/hardware_profiles_test.rb
index 59bfae0..1201e56 100644
--- a/client/tests/hardware_profiles_test.rb
+++ b/client/tests/hardware_profiles_test.rb
@@ -16,28 +16,28 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
 def prop_check(prop, value_class)
   if prop.present?
-    prop.value.should_not be_nil
-    prop.value.should be_a(value_class)
+    prop.value.wont_be_nil
+    prop.value.must_be_kind_of value_class
   end
 end
 
-describe "hardware_profiles" do
-
-  it_should_behave_like "all resources"
+describe "Hardware Profiles" do
 
   it "should allow retrieval of all hardware profiles" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
         hardware_profiles = client.hardware_profiles
-        hardware_profiles.should_not be_empty
+        hardware_profiles.wont_be_empty
         hardware_profiles.each do |hwp|
-          hwp.uri.should_not be_nil
-          hwp.uri.should be_a(String)
+          hwp.uri.wont_be_nil
+          hwp.uri.must_be_kind_of String
           prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
        end
       end
@@ -47,17 +47,17 @@ describe "hardware_profiles" do
   it "should allow filtering of hardware_profiles by architecture" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       hardware_profiles = client.hardware_profiles( :architecture=>'i386' )
-      hardware_profiles.should_not be_empty
-      hardware_profiles.size.should eql( 2 )
-      hardware_profiles.first.architecture.value.should eql( 'i386' )
+      hardware_profiles.wont_be_empty
+      hardware_profiles.size.must_equal 2
+      hardware_profiles.first.architecture.value.must_equal 'i386'
     end
   end
 
   it "should allow fetching a hardware_profile by id" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       hwp = client.hardware_profile( 'm1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
+      hwp.wont_be_nil
+      hwp.id.must_equal 'm1-small'
     end
   end
 
@@ -65,15 +65,15 @@ describe "hardware_profiles" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
     hwp1 = client.hardware_profile( 'm1-small' )
     hwp2 = client.hardware_profile( 'm1-large' )
-    hwp1.storage.value.should_not eql(hwp2.storage.value)
-    hwp1.memory.value.should_not eql(hwp2.memory.value)
+    hwp1.storage.value.wont_equal hwp2.storage.value
+    hwp1.memory.value.wont_equal hwp2.memory.value
   end
 
   it "should allow fetching a hardware_profile by URI" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       hwp = client.fetch_hardware_profile( API_URL + '/hardware_profiles/m1-small' )
-      hwp.should_not be_nil
-      hwp.id.should eql( 'm1-small' )
+      hwp.wont_be_nil
+      hwp.id.must_equal 'm1-small'
     end
   end
 
diff --git a/client/tests/images_test.rb b/client/tests/images_test.rb
index 3b209cd..b9b1492 100644
--- a/client/tests/images_test.rb
+++ b/client/tests/images_test.rb
@@ -16,28 +16,28 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
-describe "images" do
-
-  it_should_behave_like "all resources"
+describe "Images" do
 
   it "should allow retrieval of all images" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
         images = client.images
-        images.should_not be_empty
-        images.size.should eql( 3 )
+        images.wont_be_empty
+        images.size.must_equal 3
         images.each do |image|
-          image.uri.should_not be_nil
-          image.uri.should be_a(String)
-          image.description.should_not be_nil
-          image.description.should be_a(String)
-          image.architecture.should_not be_nil
-          image.architecture.should be_a(String)
-          image.owner_id.should_not be_nil
-          image.owner_id.should be_a(String)
+          image.uri.wont_be_nil
+          image.uri.must_be_kind_of String
+          image.description.wont_be_nil
+          image.description.must_be_kind_of String
+          image.architecture.wont_be_nil
+          image.architecture.must_be_kind_of String
+          image.owner_id.wont_be_nil
+          image.owner_id.must_be_kind_of String
         end
       end
     end
@@ -46,17 +46,17 @@ describe "images" do
   it "should allow retrieval of my own images" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       images = client.images( :owner_id=>:self )
-      images.should_not be_empty
-      images.size.should eql( 1 )
+      images.wont_be_empty
+      images.size.must_equal 1
       images.each do |image|
-        image.uri.should_not be_nil
-        image.uri.should be_a(String)
-        image.description.should_not be_nil
-        image.description.should be_a(String)
-        image.architecture.should_not be_nil
-        image.architecture.should be_a(String)
-        image.owner_id.should_not be_nil
-        image.owner_id.should be_a(String)
+        image.uri.wont_be_nil
+        image.uri.must_be_kind_of String
+        image.description.wont_be_nil
+        image.description.must_be_kind_of String
+        image.architecture.wont_be_nil
+        image.architecture.must_be_kind_of String
+        image.owner_id.wont_be_nil
+        image.owner_id.must_be_kind_of String
       end
     end
   end
@@ -64,20 +64,20 @@ describe "images" do
   it "should allow retrieval of a single image by ID" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       image = client.image( 'img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
+      image.wont_be_nil
+      image.uri.must_equal API_URL + '/images/img1'
+      image.id.must_equal 'img1'
+      image.architecture.must_equal 'x86_64'
     end
   end
 
   it "should allow retrieval of a single image by URI" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       image = client.fetch_image( API_URL + '/images/img1' )
-      image.should_not be_nil
-      image.uri.should eql( API_URL + '/images/img1' )
-      image.id.should eql( 'img1' )
-      image.architecture.should eql( 'x86_64' )
+      image.wont_be_nil
+      image.uri.must_equal API_URL + '/images/img1'
+      image.id.must_equal 'img1'
+      image.architecture.must_equal 'x86_64'
     end
   end
 
@@ -85,14 +85,14 @@ describe "images" do
     it "return matching images" do
       DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
         images = client.images( :architecture=>'x86_64' )
-        images.should_not be_empty
+        images.wont_be_empty
         images.each do |image|
-          image.architecture.should eql( 'x86_64' )
+          image.architecture.must_equal 'x86_64'
         end
         images = client.images( :architecture=>'i386' )
-        images.should_not be_empty
+        images.wont_be_empty
         images.each do |image|
-          image.architecture.should eql( 'i386' )
+          image.architecture.must_equal 'i386'
         end
       end
     end
@@ -100,7 +100,7 @@ describe "images" do
     it "should return an empty array for no matches" do
       DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
         images = client.images( :architecture=>'8088' )
-        images.should be_empty
+        images.must_be_empty
       end
     end
   end
diff --git a/client/tests/instance_states_test.rb b/client/tests/instance_states_test.rb
index c79c273..2981e98 100644
--- a/client/tests/instance_states_test.rb
+++ b/client/tests/instance_states_test.rb
@@ -16,41 +16,32 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
-=begin
-Spec::Matchers.define :include_transition do |action,to|
-  match do |transitions|
-    found = transitions.find{|e| e.action.to_s == action.to_s && e.to.to_s == to.to_s }
-    ! found.nil?
-  end
-end
-=end
-
-describe "instance-states" do
-
-  it_should_behave_like "all resources"
+describe "Instance States" do
 
   it "should allow retrieval of instance-state information" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
         instance_states = client.instance_states
-        instance_states.should_not be_nil
-        instance_states.should_not be_empty
+        instance_states.wont_be_nil
+        instance_states.wont_be_empty
 
-        instance_states[0].name.should eql( 'start' )
-        instance_states[0].transitions.size.should eql( 1 )
-        instance_states[0].transitions[0].should_not be_auto
+        instance_states[0].name.must_equal 'start'
+        instance_states[0].transitions.size.must_equal 1
+        instance_states[0].transitions[0].wont_equal :auto
 
-        instance_states[1].name.should eql( 'pending' )
-        instance_states[1].transitions.size.should eql( 1 )
-        instance_states[1].transitions[0].should be_auto
+        instance_states[1].name.must_equal 'pending'
+        instance_states[1].transitions.size.must_equal 1
+        instance_states[1].transitions[0].wont_equal :auto
 
-        instance_states[2].name.should eql( 'running' )
-        instance_states[2].transitions.size.should eql( 2 )
-        includes_transition( instance_states[2].transitions, :reboot, :running ).should be_true
-        includes_transition( instance_states[2].transitions, :stop, :stopped ).should be_true
+        instance_states[2].name.must_equal 'running'
+        instance_states[2].transitions.size.must_equal 2
+        includes_transition( instance_states[2].transitions, :reboot, :running ).must_equal true
+        includes_transition( instance_states[2].transitions, :stop, :stopped ).must_equal true
       end
     end
   end
@@ -58,16 +49,16 @@ describe "instance-states" do
   it "should allow retrieval of a single instance-state blob" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance_state = client.instance_state( :pending )
-      instance_state.should_not be_nil
-      instance_state.name.should eql( 'pending' )
-      instance_state.transitions.size.should eql( 1 )
-      instance_state.transitions[0].should be_auto
+      instance_state.wont_be_nil
+      instance_state.name.must_equal 'pending'
+      instance_state.transitions.size.must_equal 1
+      instance_state.transitions[0].wont_equal :auto
 
       instance_state = client.instance_state( :running )
-      instance_state.name.should eql( 'running' )
-      instance_state.transitions.size.should eql( 2 )
-      includes_transition( instance_state.transitions, :reboot, :running ).should be_true
-      includes_transition( instance_state.transitions, :stop, :stopped ).should be_true
+      instance_state.name.must_equal 'running'
+      instance_state.transitions.size.must_equal 2
+      includes_transition( instance_state.transitions, :reboot, :running ).must_equal true
+      includes_transition( instance_state.transitions, :stop, :stopped ).must_equal true
     end
   end
 
diff --git a/client/tests/instances_test.rb b/client/tests/instances_test.rb
index f7fc7e7..bff1a7f 100644
--- a/client/tests/instances_test.rb
+++ b/client/tests/instances_test.rb
@@ -16,35 +16,35 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
-describe "instances" do
-
-  it_should_behave_like "all resources"
+describe "Instances" do
 
   it "should allow retrieval of all instances" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
         instances = client.instances
-        instances.should_not be_empty
+        instances.wont_be_empty
         instances.each do |instance|
-          instance.uri.should_not be_nil
-          instance.uri.should be_a( String )
-          instance.owner_id.should_not be_nil
-          instance.owner_id.should be_a( String )
-          instance.image.should_not be_nil
-          instance.image.to_s.should match(/DeltaCloud::API::.*::Image/)
-          instance.hardware_profile.should_not be_nil
-          instance.hardware_profile.should be_a( DeltaCloud::API::Base::HardwareProfile )
-          instance.state.should_not be_nil
-          instance.state.should be_a( String )
-          instance.public_addresses.should_not be_nil
-          instance.public_addresses.should_not be_empty
-          instance.public_addresses.should be_a( Array )
-          instance.private_addresses.should_not be_nil
-          instance.private_addresses.should_not be_empty
-          instance.private_addresses.should be_a( Array )
+          instance.uri.wont_be_nil
+          instance.uri.must_be_kind_of String
+          instance.owner_id.wont_be_nil
+          instance.owner_id.must_be_kind_of String
+          instance.image.wont_be_nil
+          instance.image.to_s.must_match /DeltaCloud::API::.*::Image/
+          instance.hardware_profile.wont_be_nil
+          instance.hardware_profile.must_be_kind_of DeltaCloud::API::Base::HardwareProfile
+          instance.state.wont_be_nil
+          instance.state.must_be_kind_of String
+          instance.public_addresses.wont_be_nil
+          instance.public_addresses.wont_be_empty
+          instance.public_addresses.must_be_kind_of Array
+          instance.private_addresses.wont_be_nil
+          instance.private_addresses.wont_be_empty
+          instance.private_addresses.must_be_kind_of Array
         end
       end
     end
@@ -53,60 +53,60 @@ describe "instances" do
   it "should allow navigation from instance to image" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instances = client.instances
-      instances.should_not be_empty
+      instances.wont_be_empty
       instance = instances.first
-      instance.image.should_not be_nil
-      instance.image.description.should_not be_nil
-      instance.image.description.should be_a(String)
+      instance.image.wont_be_nil
+      instance.image.description.wont_be_nil
+      instance.image.description.must_be_kind_of String
     end
   end
 
   it "should allow retrieval of a single instance" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.instance( "inst0" )
-      instance.should_not be_nil
-      instance.name.should_not be_nil
-      instance.name.should eql( 'Mock Instance With Profile Change' )
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
-      instance.owner_id.should eql( "mockuser" )
-      instance.public_addresses.first.class.should eql(Hash)
-      instance.public_addresses.first[:type].should eql('hostname')
-      instance.public_addresses.first[:address].should eql('img1.inst0.public.com')
-      instance.image.should_not be_nil
-      instance.image.uri.should eql( API_URL + "/images/img1" )
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.should_not be_nil
-      instance.hardware_profile.uri.should eql( API_URL + "/hardware_profiles/m1-large" )
-      instance.hardware_profile.memory.value.should eql('10240')
-      instance.hardware_profile.storage.value.should eql('850')
-      instance.state.should eql( "RUNNING" )
-      instance.actions.should_not be_nil
+      instance.wont_be_nil
+      instance.name.wont_be_nil
+      instance.name.must_equal 'Mock Instance With Profile Change'
+      instance.uri.wont_be_nil
+      instance.uri.must_be_kind_of String
+      instance.owner_id.must_equal "mockuser"
+      instance.public_addresses.first.class.must_equal Hash
+      instance.public_addresses.first[:type].must_equal 'hostname'
+      instance.public_addresses.first[:address].must_equal 'img1.inst0.public.com'
+      instance.image.wont_be_nil
+      instance.image.uri.must_equal API_URL + "/images/img1"
+      instance.hardware_profile.wont_be_nil
+      instance.hardware_profile.wont_be_nil
+      instance.hardware_profile.uri.must_equal API_URL + "/hardware_profiles/m1-large" 
+      instance.hardware_profile.memory.value.must_equal '10240'
+      instance.hardware_profile.storage.value.must_equal '850'
+      instance.state.must_equal "RUNNING" 
+      instance.actions.wont_be_nil
     end
   end
 
   it "should allow creation of new instances with reasonable defaults" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.create_instance( 'img1', :name=>'TestInstance', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.name.should eql( 'TestInstance' )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'us' )
+      instance.wont_be_nil
+      instance.uri.must_match %r{#{API_URL}/instances/inst[0-9]+}
+      instance.id.must_match /inst[0-9]+/
+      instance.name.must_equal 'TestInstance'
+      instance.image.id.must_equal 'img1'
+      instance.hardware_profile.id.must_equal 'm1-large'
+      instance.realm.id.must_equal 'us'
     end
   end
 
   it "should allow creation of new instances with specific realm" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.create_instance( 'img1', :realm=>'eu', :hardware_profile => 'm1-large' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-large' )
-      instance.realm.id.should eql( 'eu' )
+      instance.wont_be_nil
+      instance.uri.must_match %r{#{API_URL}/instances/inst[0-9]+}
+      instance.id.must_match  /inst[0-9]+/
+      instance.image.id.must_equal 'img1'
+      instance.hardware_profile.id.must_equal 'm1-large'
+      instance.realm.id.must_equal 'eu'
     end
   end
 
@@ -114,12 +114,12 @@ describe "instances" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.create_instance( 'img1',
                                          :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'us' )
+      instance.wont_be_nil
+      instance.uri.must_match  %r{#{API_URL}/instances/inst[0-9]+}
+      instance.id.must_match  /inst[0-9]+/
+      instance.image.id.must_equal 'img1'
+      instance.hardware_profile.id.must_equal 'm1-xlarge'
+      instance.realm.id.must_equal 'us'
     end
   end
 
@@ -127,13 +127,13 @@ describe "instances" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       hwp = { :id => 'm1-xlarge', :memory => 32768 }
       instance = client.create_instance( 'img1', :hardware_profile=> hwp )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.hardware_profile.memory.value.should eql('12288')
-      instance.realm.id.should eql( 'us' )
+      instance.wont_be_nil
+      instance.uri.must_match  %r{#{API_URL}/instances/inst[0-9]+}
+      instance.id.must_match  /inst[0-9]+/
+      instance.image.id.must_equal 'img1'
+      instance.hardware_profile.id.must_equal 'm1-xlarge'
+      instance.hardware_profile.memory.value.must_equal'12288'
+      instance.realm.id.must_equal 'us' 
     end
   end
 
@@ -141,30 +141,30 @@ describe "instances" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.create_instance( 'img1', :realm=>'eu',
                                          :hardware_profile=>'m1-xlarge' )
-      instance.should_not be_nil
-      instance.uri.should match( %r{#{API_URL}/instances/inst[0-9]+} )
-      instance.id.should match( /inst[0-9]+/ )
-      instance.image.id.should eql( 'img1' )
-      instance.hardware_profile.id.should eql( 'm1-xlarge' )
-      instance.realm.id.should eql( 'eu' )
+      instance.wont_be_nil
+      instance.uri.must_match  %r{#{API_URL}/instances/inst[0-9]+}
+      instance.id.must_match  /inst[0-9]+/
+      instance.image.id.must_equal 'img1'
+      instance.hardware_profile.id.must_equal 'm1-xlarge'
+      instance.realm.id.must_equal 'eu'
     end
   end
 
   it "should allow fetching of instances by id" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.instance( 'inst1' )
-      instance.should_not be_nil
-      instance.uri.should_not be_nil
-      instance.uri.should be_a( String )
+      instance.wont_be_nil
+      instance.uri.wont_be_nil
+      instance.uri.must_be_kind_of String
     end
   end
 
   it "should allow fetching of instances by URI" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       instance = client.fetch_instance( API_URL + '/instances/inst1' )
-      instance.should_not be_nil
-      instance.uri.should eql( API_URL + '/instances/inst1' )
-      instance.id.should eql( 'inst1' )
+      instance.wont_be_nil
+      instance.uri.must_equal API_URL + '/instances/inst1'
+      instance.id.must_equal 'inst1'
     end
   end
 
@@ -172,26 +172,26 @@ describe "instances" do
     it "should allow actions that are valid" do
       DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
         instance = client.instance( 'inst1' )
-        instance.should_not be_nil
-        instance.state.should eql( "RUNNING" )
-        instance.uri.should eql( API_URL + '/instances/inst1' )
-        instance.id.should eql( 'inst1' )
+        instance.wont_be_nil
+        instance.state.must_equal "RUNNING"
+        instance.uri.must_equal API_URL + '/instances/inst1'
+        instance.id.must_equal 'inst1'
         instance.stop!
-        instance.state.should eql( "STOPPED" )
+        instance.state.must_equal "STOPPED"
         instance.start!
-        instance.state.should eql( "RUNNING" )
+        instance.state.must_equal "RUNNING"
       end
     end
 
     it "should not allow actions that are invalid" do
       DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
         instance = client.instance( 'inst1' )
-        instance.should_not be_nil
+        instance.wont_be_nil
         unless instance.state.eql?("RUNNING")
           instance.start!
         end
-        instance.state.should eql( "RUNNING" )
-        lambda{instance.start!}.should raise_error
+        instance.state.must_equal "RUNNING"
+        lambda{instance.start!}.must_raise NoMethodError
       end
     end
 
@@ -201,9 +201,7 @@ describe "instances" do
                                            :name=>'TestDestroyInstance',
                                            :hardware_profile => 'm1-xlarge' )
         instance.stop!
-        lambda {
-          instance.destroy!
-        }.should_not raise_error
+        instance.destroy!.must_be_nil
       end
     end
   end
diff --git a/client/tests/keys_tests.rb b/client/tests/keys_tests.rb
index fa2ff54..ecd661a 100644
--- a/client/tests/keys_tests.rb
+++ b/client/tests/keys_tests.rb
@@ -16,20 +16,23 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
+
+require_relative './test_helper.rb'
 
 def check_key(the_key, key_name = "")
-  the_key.should_not be_nil
-  the_key.id.should be_a(String)
-  the_key.id.should eql(key_name)
-  the_key.actions.should_not be_nil
-  the_key.actions.size.should eql(1)
-  the_key.actions.first[0].should eql("destroy")
-  the_key.actions.first[1].should eql("#{API_URL}/keys/#{key_name}")
-  the_key.fingerprint.should_not be_nil
-  the_key.fingerprint.should be_a(String)
-  the_key.pem.should_not be_nil
-  the_key.pem.first.should be_a(String)
+  the_key.wont_be_nil
+  the_key.id.must_be_kind_of String
+  the_key.id.must_equal key_name
+  the_key.actions.wont_be_nil
+  the_key.actions.size.must_equal 1
+  the_key.actions.first[0].must_equal "destroy"
+  the_key.actions.first[1].must_equal "#{API_URL}/keys/#{key_name}"
+  the_key.fingerprint.wont_be_nil
+  the_key.fingerprint.must_be_kind_of String
+  the_key.pem.wont_be_nil
+  the_key.pem.must_be_kind_of String
 end
 
 def create_key_if_necessary(client, key_name)
@@ -40,22 +43,17 @@ def create_key_if_necessary(client, key_name)
 end
 
 
-describe "keys" do
-
-  it_should_behave_like "all resources"
-
+describe "Keys" do
   it "should allow retrieval of all keys" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        lambda{
-              client.keys
-              }.should_not raise_error
+        client.keys.wont_be_empty
       end
     end
   end
 end
 
-describe "operations on keys" do
+describe "Operations on Keys" do
 
   it "should allow successful creation of a new key" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
@@ -79,7 +77,7 @@ describe "operations on keys" do
       create_key_if_necessary(client, name)
       lambda{
               client.create_key({:name => name})
-            }.should raise_error
+            }.must_raise DeltaCloud::HTTPError::Forbidden
     end
   end
 
@@ -88,9 +86,7 @@ describe "operations on keys" do
       name = "my_new_key"
       create_key_if_necessary(client, name)
       the_key = client.key(name)
-      lambda{
-              the_key.destroy!
-            }.should_not raise_error
+      the_key.destroy!.must_be_nil
     end
   end
 
diff --git a/client/tests/realms_test.rb b/client/tests/realms_test.rb
index 241fb5c..d01a825 100644
--- a/client/tests/realms_test.rb
+++ b/client/tests/realms_test.rb
@@ -16,26 +16,27 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-require 'specs/spec_helper'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-describe "realms" do
+require_relative './test_helper.rb'
 
-  it_should_behave_like "all resources"
+describe "Realms" do
+
+  before do
+    @client = DeltaCloud.new(API_NAME, API_PASSWORD, API_URL)
+  end
 
   it "should allow retrieval of all realms" do
-    [API_URL, API_URL_REDIRECT].each do |entry_point|
-      DeltaCloud.new( API_NAME, API_PASSWORD, entry_point ) do |client|
-        realms = client.realms
-        realms.should_not be_empty
-        realms.each do |realm|
-          realm.uri.should_not be_nil
-          realm.uri.should be_a(String)
-          realm.id.should_not be_nil
-          realm.id.should be_a(String)
-          realm.name.should_not be_nil
-          realm.name.should be_a(String)
-        end
-      end
+    realms = @client.realms
+    realms.wont_be_empty
+    realms.each do |realm|
+      realm.uri.wont_be_nil
+      realm.uri.must_be_kind_of String
+      realm.id.wont_be_nil
+      realm.id.must_be_kind_of String
+      realm.name.wont_be_nil
+      realm.name.must_be_kind_of String
     end
   end
 
@@ -43,23 +44,23 @@ describe "realms" do
   it "should allow fetching a realm by id" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       realm = client.realm( 'us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
-      realm.name.should eql( 'United States' )
-      realm.state.should eql( 'AVAILABLE' )
+      realm.wont_be_nil
+      realm.id.must_equal 'us'
+      realm.name.must_equal 'United States'
+      realm.state.must_equal 'AVAILABLE'
       realm = client.realm( 'eu' )
-      realm.should_not be_nil
-      realm.id.should eql( 'eu' )
-      realm.name.should eql( 'Europe' )
-      realm.state.should eql( 'AVAILABLE' )
+      realm.wont_be_nil
+      realm.id.must_equal 'eu'
+      realm.name.must_equal 'Europe'
+      realm.state.must_equal 'AVAILABLE'
     end
   end
 
   it "should allow fetching a realm by URI" do
     DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
       realm = client.fetch_realm( API_URL + '/realms/us' )
-      realm.should_not be_nil
-      realm.id.should eql( 'us' )
+      realm.wont_be_nil
+      realm.id.must_equal 'us'
     end
   end
 
diff --git a/client/tests/storage_snapshot_test.rb b/client/tests/storage_snapshot_test.rb
index 94f149c..b26454b 100644
--- a/client/tests/storage_snapshot_test.rb
+++ b/client/tests/storage_snapshot_test.rb
@@ -16,66 +16,66 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
-describe "storage snapshot" do
-
-  it_should_behave_like "all resources"
+describe "Storage Snapshot" do
 
   it "allow retrieval of all storage volumes owned by the current user" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_snapshots = client.storage_snapshots
-        storage_snapshots.should_not be_nil
-        storage_snapshots.should_not be_empty
+      client.connect do |c|
+        storage_snapshots = c.storage_snapshots
+        storage_snapshots.wont_be_nil
+        storage_snapshots.wont_be_empty
         ids = storage_snapshots.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'snap2' )
-        ids.should include( 'snap3' )
+        ids.size.must_equal 3
+        ids.must_include 'snap2'
+        ids.must_include 'snap3'
       end
     end
   end
 
   it "should allow fetching of storage volume by id" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.storage_snapshot( 'snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
+    client.connect do |c|
+      storage_snapshot = c.storage_snapshot( 'snap2' )
+      storage_snapshot.wont_be_nil
+      storage_snapshot.id.must_equal 'snap2'
+      storage_snapshot.storage_volume.capacity.must_equal 1.0
+      storage_snapshot.storage_volume.id.must_equal 'vol2'
     end
   end
 
   it "should allow fetching of storage volume by URI"  do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_snapshot = client.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
-      storage_snapshot.should_not be_nil
-      storage_snapshot.id.should eql( 'snap2' )
-      storage_snapshot.storage_volume.capacity.should eql( 1.0 )
-      storage_snapshot.storage_volume.id.should eql( 'vol2' )
+    client.connect do |c|
+      storage_snapshot = c.fetch_storage_snapshot( API_URL + '/storage_snapshots/snap2' )
+      storage_snapshot.wont_be_nil
+      storage_snapshot.id.must_equal 'snap2'
+      storage_snapshot.storage_volume.capacity.must_equal 1.0
+      storage_snapshot.storage_volume.id.must_equal 'vol2'
     end
   end
 
   it "should return nil for unknown storage volume by ID" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
     lambda {
-      client.connect do |client|
-        client.storage_snapshot( "bogus" )
+      client.connect do |c|
+        c.storage_snapshot( "bogus" )
       end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    }.must_raise DeltaCloud::HTTPError::NotFound
   end
 
   it "should return nil for unknown storage volume by URI" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
     lambda {
-      client.connect do |client|
-        client.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
+      client.connect do |c|
+        c.fetch_storage_snapshot( API_URL + '/storage_snapshots/bogus' )
       end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    }.must_raise DeltaCloud::HTTPError::NotFound
   end
 
 end
diff --git a/client/tests/storage_volume_test.rb b/client/tests/storage_volume_test.rb
index 8fb153e..1d6bd8d 100644
--- a/client/tests/storage_volume_test.rb
+++ b/client/tests/storage_volume_test.rb
@@ -16,75 +16,75 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
 
-require 'specs/spec_helper'
+require_relative './test_helper.rb'
 
-describe "storage volumes" do
-
-  it_should_behave_like "all resources"
+describe "Storage Volumes" do
 
   it "allow retrieval of all storage volumes owned by the current user" do
     [API_URL, API_URL_REDIRECT].each do |entry_point|
       client = DeltaCloud.new( API_NAME, API_PASSWORD, entry_point )
-      client.connect do |client|
-        storage_volumes = client.storage_volumes
-        storage_volumes.should_not be_nil
-        storage_volumes.should_not be_empty
+      client.connect do |c|
+        storage_volumes = c.storage_volumes
+        storage_volumes.wont_be_nil
+        storage_volumes.wont_be_nil
         ids = storage_volumes.collect{|e| e.id}
-        ids.size.should eql( 3 )
-        ids.should include( 'vol2' )
-        ids.should include( 'vol3' )
+        ids.size.must_equal 3
+        ids.must_include 'vol1'
+        ids.must_include 'vol3'
       end
     end
   end
 
   it "should allow fetching of storage volume by id" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.storage_volume( 'vol3' )
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
+    client.connect do |c|
+      storage_volume = c.storage_volume( 'vol3' )
+      storage_volume.id.must_equal 'vol3'
+      storage_volume.uri.must_equal API_URL + '/storage_volumes/vol3'
+      storage_volume.capacity.must_equal 1.0
+      storage_volume.device.must_equal '/dev/sda1'
+      storage_volume.instance.wont_be_nil
+      storage_volume.instance.id.must_equal 'inst1'
       ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
+      ip.hardware_profile.architecture.value.must_equal 'i386'
     end
   end
 
   it "should allow fetching of storage volume by URI" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
-    client.connect do |client|
-      storage_volume = client.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
-      storage_volume.should_not be_nil
-      storage_volume.id.should eql( 'vol3' )
-      storage_volume.uri.should eql( API_URL + '/storage_volumes/vol3' )
-      storage_volume.capacity.should eql( 1.0 )
-      storage_volume.device.should eql( '/dev/sda1' )
-      storage_volume.instance.should_not be_nil
-      storage_volume.instance.id.should eql( 'inst1' )
+    client.connect do |c|
+      storage_volume = c.fetch_storage_volume( API_URL + '/storage_volumes/vol3' )
+      storage_volume.wont_be_nil
+      storage_volume.id.must_equal 'vol3'
+      storage_volume.uri.must_equal API_URL + '/storage_volumes/vol3'
+      storage_volume.capacity.must_equal 1.0
+      storage_volume.device.must_equal '/dev/sda1'
+      storage_volume.instance.wont_be_nil
+      storage_volume.instance.id.must_equal 'inst1'
       ip = storage_volume.instance
-      ip.hardware_profile.architecture.value.should eql( 'i386' )
+      ip.hardware_profile.architecture.value.must_equal 'i386'
     end
   end
 
   it "should raise exception for unknown storage volume by ID" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
     lambda {
-      client.connect do |client|
-        client.storage_volume( 'bogus' )
+      client.connect do |c|
+        c.storage_volume( 'bogus' )
       end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    }.must_raise DeltaCloud::HTTPError::NotFound
   end
 
   it "should raise exception for unknown storage volume by URI" do
     client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
     lambda {
-      client.connect do |client|
+      client.connect do |c|
         client.fetch_storage_volume( API_URL + '/storage_volumes/bogus' )
       end
-    }.should raise_error(DeltaCloud::HTTPError::NotFound)
+    }.must_raise DeltaCloud::HTTPError::NotFound
   end
 
 
diff --git a/client/tests/test_helper.rb b/client/tests/test_helper.rb
new file mode 100644
index 0000000..40a2c02
--- /dev/null
+++ b/client/tests/test_helper.rb
@@ -0,0 +1,17 @@
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
+require 'minitest/autorun'
+
+require_relative '../lib/deltacloud.rb'
+
+# Configuration:
+
+API_HOST = 'localhost'
+API_PORT = '3001'
+API_PATH = '/api'
+
+API_NAME = 'mockuser'
+API_PASSWORD = 'mockpassword'
+
+API_URL_REDIRECT = "http://#{API_HOST}:#{API_PORT}"
+API_URL = "#{API_URL_REDIRECT}#{API_PATH}"
-- 
1.7.10.2


Re: [PATCH core 2/6] Client: Removed unused rake tasks and added test task

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2012-08-08 at 14:54 +0200, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> * Fixtures generators are not needed
> * Removed task for deltacloudc
> * Added minitest task
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>

You should also remove the rspec stuff:

diff --git a/client/Rakefile b/client/Rakefile
index 9ced4ad..255f735 100644
--- a/client/Rakefile
+++ b/client/Rakefile
@@ -31,23 +31,6 @@ Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar = true
 end
 
-def available?(name)
-  Gem::Specification.find_by_name(name)
-rescue Gem::LoadError
-  false
-rescue
-  Gem.available?(name)
-end
-
-if available?('rspec')
-  require 'rspec/core/rake_task'
-  desc "Run all examples"
-  RSpec::Core::RakeTask.new('spec') do |t|
-    t.pattern = FileList['specs/**/*_spec.rb']
-    t.rspec_opts = [ "--format", "nested", "--color"]
-  end
-end
-
 desc "Reinstall gem"
 task :reinstall do
   puts %x{gem uninstall deltacloud-client --all -I -x}



[PATCH core 2/6] Client: Removed unused rake tasks and added test task

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* Fixtures generators are not needed
* Removed task for deltacloudc
* Added minitest task

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/Rakefile |   27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/client/Rakefile b/client/Rakefile
index c5a9f70..9ced4ad 100644
--- a/client/Rakefile
+++ b/client/Rakefile
@@ -26,7 +26,6 @@ task 'documentation' do
   load 'lib/documentation.rb'
 end
 
-
 spec = Gem::Specification.load('deltacloud-client.gemspec')
 Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar = true
@@ -56,26 +55,8 @@ task :reinstall do
   puts %x{gem install deltacloud-client-*.gem --local}
 end
 
-desc "Setup Fixtures"
-task 'fixtures' do
-  FileUtils.rm_rf( File.dirname( __FILE__ ) + '/specs/data' )
-  FileUtils.cp_r( File.dirname( __FILE__ ) + '/specs/fixtures', File.dirname( __FILE__ ) + '/specs/data' )
-end
-
-namespace :test do
-  Rake::TestTask.new(:cmd) do |t|
-    t.libs << "tests"
-    t.test_files = FileList['tests/cmd.rb']
-    t.verbose = true
-  end
-end
-
-desc "Clean Fixtures"
-task 'fixtures:clean' do
-  FileUtils.rm_rf( File.dirname( __FILE__ ) + '/specs/data' )
-end
-
-begin
-  require 'ci/reporter/rake/rspec'
-rescue LoadError
+Rake::TestTask.new(:test) do |t|
+  t.test_files = FileList[
+    'tests/*test.rb',                     # EC2 frontend internal API tests
+  ]
 end
-- 
1.7.10.2


[PATCH core 4/6] Client: Return 'nil' from destroy operations on buckets/blobs

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* All :destroy operation should return 'nil' when they succeed

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/lib/client_bucket_methods.rb |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/lib/client_bucket_methods.rb b/client/lib/client_bucket_methods.rb
index 44eca0f..a3dfda0 100644
--- a/client/lib/client_bucket_methods.rb
+++ b/client/lib/client_bucket_methods.rb
@@ -27,7 +27,7 @@ module ClientBucketMethods
     #actually response here is 204 - no content - so nothing returned to client?
     request(:delete, "#{api_uri.to_s}/buckets/#{params['id']}") do |response|
       handle_backend_error(response) if response.code!=204
-      response
+      nil if response.code == 204
     end
   end
 
@@ -53,7 +53,7 @@ module ClientBucketMethods
   def destroy_blob(params)
     request(:delete, "#{api_uri.to_s}/buckets/#{params['bucket']}/#{params[:id]}") do |response|
       handle_backend_error(response) if response.code!=204
-      response
+      nil if response.code == 204
     end
   end
 
-- 
1.7.10.2


Re: [PATCH core 1/6] Client: Moved all tests to tests directory

Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2012-08-08 at 14:54 +0200, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> * Removed obsoleted fixtures. They are provided by deltacloud-core
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>

ACK to the series; patches 1/6 and 6/6 have some whitespace errors that
should be corrected before pushing.

David