From: Ronelle Landy <[email protected]>
---
client/tests/buckets_test.rb | 18 +++++------
client/tests/client_test.rb | 18 +++++------
client/tests/hardware_profiles_test.rb | 18 +++++------
client/tests/images_test.rb | 28 ++++++++----------
client/tests/instance_states_test.rb | 30 +++++++++----------
client/tests/instances_test.rb | 48 +++++++++++++++----------------
client/tests/keys_test.rb | 6 +--
client/tests/storage_snapshot_test.rb | 20 ++++++-------
client/tests/storage_volume_test.rb | 20 ++++++-------
9 files changed, 94 insertions(+), 112 deletions(-)
diff --git a/client/tests/buckets_test.rb b/client/tests/buckets_test.rb
index d2a7fca..5ef6969 100644
--- a/client/tests/buckets_test.rb
+++ b/client/tests/buckets_test.rb
@@ -21,16 +21,14 @@ require_relative './test_helper.rb'
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.wont_be_empty
- buckets.each do |bucket|
- 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
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ buckets = client.buckets
+ buckets.wont_be_empty
+ buckets.each do |bucket|
+ 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
diff --git a/client/tests/client_test.rb b/client/tests/client_test.rb
index 713f2f2..59c39db 100644
--- a/client/tests/client_test.rb
+++ b/client/tests/client_test.rb
@@ -28,16 +28,14 @@ describe "initializing the client" do
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].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
+ DeltaCloud.new( "name", "password", API_URL ) do |client|
+ 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
diff --git a/client/tests/hardware_profiles_test.rb
b/client/tests/hardware_profiles_test.rb
index 3a0c18e..1f775d0 100644
--- a/client/tests/hardware_profiles_test.rb
+++ b/client/tests/hardware_profiles_test.rb
@@ -28,16 +28,14 @@ end
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.wont_be_empty
- hardware_profiles.each do |hwp|
- hwp.uri.wont_be_nil
- hwp.uri.must_be_kind_of String
- prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
- end
- end
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ hardware_profiles = client.hardware_profiles
+ hardware_profiles.wont_be_empty
+ hardware_profiles.each do |hwp|
+ hwp.uri.wont_be_nil
+ hwp.uri.must_be_kind_of String
+ prop_check(hwp.architecture, String) unless hwp.name.eql?("opaque")
+ end
end
end
diff --git a/client/tests/images_test.rb b/client/tests/images_test.rb
index e6e4f78..91cc961 100644
--- a/client/tests/images_test.rb
+++ b/client/tests/images_test.rb
@@ -21,21 +21,19 @@ require_relative './test_helper.rb'
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.wont_be_empty
- images.size.must_equal 3
- images.each do |image|
- 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
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ images = client.images
+ images.wont_be_empty
+ images.size.must_equal 3
+ images.each do |image|
+ 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
diff --git a/client/tests/instance_states_test.rb
b/client/tests/instance_states_test.rb
index 1116ecc..f665676 100644
--- a/client/tests/instance_states_test.rb
+++ b/client/tests/instance_states_test.rb
@@ -21,25 +21,23 @@ require_relative './test_helper.rb'
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.wont_be_nil
- instance_states.wont_be_empty
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ instance_states = client.instance_states
+ instance_states.wont_be_nil
+ instance_states.wont_be_empty
- 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[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.must_equal 'pending'
- instance_states[1].transitions.size.must_equal 1
- instance_states[1].transitions[0].wont_equal :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.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
+ 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
diff --git a/client/tests/instances_test.rb b/client/tests/instances_test.rb
index ac13ae2..0ad990b 100644
--- a/client/tests/instances_test.rb
+++ b/client/tests/instances_test.rb
@@ -21,28 +21,26 @@ require_relative './test_helper.rb'
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.wont_be_empty
- instances.each do |instance|
- 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
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ instances = client.instances
+ instances.wont_be_empty
+ instances.each do |instance|
+ 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
@@ -74,10 +72,10 @@ describe "Instances" do
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.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.state.must_equal "RUNNING"
instance.actions.wont_be_nil
end
end
@@ -130,7 +128,7 @@ describe "Instances" do
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'
+ instance.realm.id.must_equal 'us'
end
end
diff --git a/client/tests/keys_test.rb b/client/tests/keys_test.rb
index 74328fe..aa4d559 100644
--- a/client/tests/keys_test.rb
+++ b/client/tests/keys_test.rb
@@ -42,10 +42,8 @@ end
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|
- client.keys.wont_be_empty
- end
+ DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
+ client.keys.wont_be_empty
end
end
end
diff --git a/client/tests/storage_snapshot_test.rb
b/client/tests/storage_snapshot_test.rb
index 6f1662c..aefe9a5 100644
--- a/client/tests/storage_snapshot_test.rb
+++ b/client/tests/storage_snapshot_test.rb
@@ -21,17 +21,15 @@ require_relative './test_helper.rb'
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 |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.must_equal 3
- ids.must_include 'snap2'
- ids.must_include 'snap3'
- end
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+ 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.must_equal 3
+ ids.must_include 'snap2'
+ ids.must_include 'snap3'
end
end
diff --git a/client/tests/storage_volume_test.rb
b/client/tests/storage_volume_test.rb
index 9df790f..95c6d18 100644
--- a/client/tests/storage_volume_test.rb
+++ b/client/tests/storage_volume_test.rb
@@ -21,17 +21,15 @@ require_relative './test_helper.rb'
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 |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.must_equal 3
- ids.must_include 'vol1'
- ids.must_include 'vol3'
- end
+ client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+ 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.must_equal 3
+ ids.must_include 'vol1'
+ ids.must_include 'vol3'
end
end
--
1.7.7.6