incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/3] Fixed RSpec tests inside client to reflect relative URLs
Date Mon, 21 Feb 2011 14:50:13 GMT
From: Michal Fojtik <mfojtik@redhat.com>

---
 client/specs/images_spec.rb         |    4 ++--
 client/specs/initialization_spec.rb |   10 +++++-----
 client/specs/instances_spec.rb      |   18 +++++++++---------
 client/specs/storage_volume_spec.rb |    4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/client/specs/images_spec.rb b/client/specs/images_spec.rb
index 3b209cd..e76f3ad 100644
--- a/client/specs/images_spec.rb
+++ b/client/specs/images_spec.rb
@@ -65,7 +65,7 @@ describe "images" 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.uri.should eql( API_PATH + '/images/img1' )
       image.id.should eql( 'img1' )
       image.architecture.should eql( 'x86_64' )
     end
@@ -75,7 +75,7 @@ describe "images" 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.uri.should eql( API_PATH + '/images/img1' )
       image.id.should eql( 'img1' )
       image.architecture.should eql( 'x86_64' )
     end
diff --git a/client/specs/initialization_spec.rb b/client/specs/initialization_spec.rb
index 672d858..da17cdc 100644
--- a/client/specs/initialization_spec.rb
+++ b/client/specs/initialization_spec.rb
@@ -30,11 +30,11 @@ describe "initializing the client" do
   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[:hardware_profiles].should eql( "#{API_PATH}/hardware_profiles"
)
+        client.entry_points[:images].should            eql( "#{API_PATH}/images" )
+        client.entry_points[:instances].should         eql( "#{API_PATH}/instances" )
+        client.entry_points[:storage_volumes].should   eql( "#{API_PATH}/storage_volumes"
)
+        client.entry_points[:storage_snapshots].should eql( "#{API_PATH}/storage_snapshots"
)
       end
     end
   end
diff --git a/client/specs/instances_spec.rb b/client/specs/instances_spec.rb
index c309c24..6d59cab 100644
--- a/client/specs/instances_spec.rb
+++ b/client/specs/instances_spec.rb
@@ -72,10 +72,10 @@ describe "instances" do
       instance.owner_id.should eql( "mockuser" )
       instance.public_addresses.first.should eql( "img1.inst0.public.com" )
       instance.image.should_not be_nil
-      instance.image.uri.should eql( API_URL + "/images/img1" )
+      instance.image.uri.should eql( API_PATH + "/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.uri.should eql( API_PATH + "/hardware_profiles/m1-large"
)
       instance.hardware_profile.memory.value.should eql(10240.0)
       instance.hardware_profile.storage.value.should eql(850.0)
       instance.state.should eql( "RUNNING" )
@@ -87,7 +87,7 @@ describe "instances" 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.uri.should match( %r{#{API_PATH}/instances/inst[0-9]+} )
       instance.id.should match( /inst[0-9]+/ )
       instance.name.should eql( 'TestInstance' )
       instance.image.id.should eql( 'img1' )
@@ -100,7 +100,7 @@ describe "instances" 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.uri.should match( %r{#{API_PATH}/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' )
@@ -113,7 +113,7 @@ describe "instances" do
       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.uri.should match( %r{#{API_PATH}/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' )
@@ -126,7 +126,7 @@ describe "instances" do
       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.uri.should match( %r{#{API_PATH}/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' )
@@ -140,7 +140,7 @@ describe "instances" do
       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.uri.should match( %r{#{API_PATH}/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' )
@@ -161,7 +161,7 @@ describe "instances" 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.uri.should eql( API_PATH + '/instances/inst1' )
       instance.id.should eql( 'inst1' )
     end
   end
@@ -172,7 +172,7 @@ describe "instances" do
         instance = client.instance( 'inst1' )
         instance.should_not be_nil
         instance.state.should eql( "RUNNING" )
-        instance.uri.should eql( API_URL + '/instances/inst1' )
+        instance.uri.should eql( API_PATH + '/instances/inst1' )
         instance.id.should eql( 'inst1' )
         instance.stop!
         instance.state.should eql( "STOPPED" )
diff --git a/client/specs/storage_volume_spec.rb b/client/specs/storage_volume_spec.rb
index 4ed23b7..d90129c 100644
--- a/client/specs/storage_volume_spec.rb
+++ b/client/specs/storage_volume_spec.rb
@@ -43,7 +43,7 @@ describe "storage volumes" do
     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.uri.should eql( API_PATH + '/storage_volumes/vol3' )
       storage_volume.capacity.should eql( 1.0 )
       storage_volume.device.should eql( '/dev/sda1' )
       storage_volume.instance.should_not be_nil
@@ -59,7 +59,7 @@ describe "storage volumes" do
       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.uri.should eql( API_PATH + '/storage_volumes/vol3' )
       storage_volume.capacity.should eql( 1.0 )
       storage_volume.device.should eql( '/dev/sda1' )
       storage_volume.instance.should_not be_nil
-- 
1.7.4


Mime
View raw message