incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1005767 - in /incubator/deltacloud/trunk/server: ./ tests/ tests/drivers/ tests/drivers/mock/
Date Fri, 08 Oct 2010 10:38:49 GMT
Author: mfojtik
Date: Fri Oct  8 10:38:48 2010
New Revision: 1005767

URL: http://svn.apache.org/viewvc?rev=1005767&view=rev
Log:
Moving mock unit tests under its separate structure.

Added:
    incubator/deltacloud/trunk/server/tests/drivers/
    incubator/deltacloud/trunk/server/tests/drivers/mock/
    incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/api_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/hardware_profiles_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/hardware_profiles_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/images_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/images_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/instance_states_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/instance_states_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/instances_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/instances_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/realms_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/realms_test.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/url_for_test.rb
      - copied, changed from r1005765, incubator/deltacloud/trunk/server/tests/url_for_test.rb
Removed:
    incubator/deltacloud/trunk/server/tests/api_test.rb
    incubator/deltacloud/trunk/server/tests/hardware_profiles_test.rb
    incubator/deltacloud/trunk/server/tests/images_test.rb
    incubator/deltacloud/trunk/server/tests/instance_states_test.rb
    incubator/deltacloud/trunk/server/tests/instances_test.rb
    incubator/deltacloud/trunk/server/tests/realms_test.rb
    incubator/deltacloud/trunk/server/tests/url_for_test.rb
Modified:
    incubator/deltacloud/trunk/server/Rakefile

Modified: incubator/deltacloud/trunk/server/Rakefile
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/Rakefile?rev=1005767&r1=1005766&r2=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/Rakefile (original)
+++ incubator/deltacloud/trunk/server/Rakefile Fri Oct  8 10:38:48 2010
@@ -30,15 +30,7 @@ end
 
 desc "Run basic unit tests"
 Rake::TestTask.new("test") { |t|
-  t.test_files = FileList[
-    'tests/api_test.rb',
-    'tests/hardware_profiles_test.rb',
-    'tests/realms_test.rb',
-    'tests/images_test.rb',
-    'tests/instances_test.rb',
-    'tests/instance_states_test.rb',
-    'tests/url_for_test.rb'
-  ]
+  t.test_files = FileList.new('tests/**/*_test.rb')
   t.verbose = true
   t.warning = false
 }

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb (from r1005765, incubator/deltacloud/trunk/server/tests/api_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb&p1=incubator/deltacloud/trunk/server/tests/api_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/api_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb Fri Oct  8 10:38:48 2010
@@ -1,4 +1,4 @@
-$:.unshift File.join(File.dirname(__FILE__), '..')
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -11,7 +11,7 @@ module DeltacloudUnitTest
 
     def test_it_returns_entry_points
       do_xml_request '/api'
-      (last_xml_response/'/api/link').to_a.size.should > 0
+      (last_xml_response/'/api/link').length.should > 0
     end
 
     def test_it_has_correct_attributes_set

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/hardware_profiles_test.rb (from
r1005765, incubator/deltacloud/trunk/server/tests/hardware_profiles_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/hardware_profiles_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/hardware_profiles_test.rb&p1=incubator/deltacloud/trunk/server/tests/hardware_profiles_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/hardware_profiles_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/hardware_profiles_test.rb Fri Oct
 8 10:38:48 2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -10,7 +11,7 @@ module DeltacloudUnitTest
 
     def test_it_returns_hardware_profiles
       do_xml_request '/api/hardware_profiles'
-      (last_xml_response/'hardware_profiles/hardware_profile').to_a.size.should > 0
+      (last_xml_response/'hardware_profiles/hardware_profile').length.should > 0
     end
 
     def test_it_has_correct_attributes_set
@@ -90,26 +91,25 @@ module DeltacloudUnitTest
     private
 
     def test_profile_properties(profile)
-      
       (profile/'property').each do |properties|
         properties.attributes.keys.sort.should == [ 'kind', 'name', 'unit', 'value' ]
       end
 
       (profile/'property[@name="architecture"]').first['kind'].should == 'fixed'
       (profile/'property[@name="architecture"]').first['unit'].should == 'label'
-      
+
       (profile/'property[@name="memory"]').first['kind'].should == 'range'
       (profile/'property[@name="memory"]').first['unit'].should == 'MB'
-      (profile/'property[@name="memory"]/range').size.should == 1
+      (profile/'property[@name="memory"]/range').length.should == 1
       (profile/'property[@name="memory"]/range').first.attributes.keys.sort.should == [ 'first',
'last' ]
 
       (profile/'property[@name="cpu"]').first['kind'].should == 'fixed'
       (profile/'property[@name="cpu"]').first['unit'].should == 'count'
-      
+
       (profile/'property[@name="storage"]').first['kind'].should == 'enum'
       (profile/'property[@name="storage"]').first['unit'].should == 'GB'
-      (profile/'property[@name="storage"]/enum').size.should == 1
-      (profile/'property[@name="storage"]/enum/entry').to_a.size.should == 3
+      (profile/'property[@name="storage"]/enum').length.should == 1
+      (profile/'property[@name="storage"]/enum/entry').length.should == 3
       (profile/'property[@name="storage"]/enum/entry').each do |entry|
         entry.attributes.keys.should == [ 'value' ]
         entry['value'].should_not == nil

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/images_test.rb (from r1005765,
incubator/deltacloud/trunk/server/tests/images_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/images_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/images_test.rb&p1=incubator/deltacloud/trunk/server/tests/images_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/images_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/images_test.rb Fri Oct  8 10:38:48
2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -14,7 +15,7 @@ module DeltacloudUnitTest
 
     def test_it_returns_images
       do_xml_request '/api/images', {}, true
-      (last_xml_response/'images/image').to_a.size.should > 0
+      (last_xml_response/'images/image').length.should > 0
     end
 
     def test_it_has_correct_attributes_set
@@ -57,24 +58,24 @@ module DeltacloudUnitTest
 
     def test_it_can_filter_using_owner_id
       do_xml_request '/api/images', { :owner_id => 'mockuser' }, true
-      (last_xml_response/'images/image').size.should == 1
+      (last_xml_response/'images/image').length.should == 1
       (last_xml_response/'images/image/owner_id').first.text.should == 'mockuser'
     end
 
     def test_it_can_filter_using_unknown_owner_id
       do_xml_request '/api/images', { :architecture => 'unknown_user' }, true
-      (last_xml_response/'images/image').size.should == 0
+      (last_xml_response/'images/image').length.should == 0
     end
 
     def test_it_can_filter_using_architecture
       do_xml_request '/api/images', { :architecture => 'x86_64' }, true
-      (last_xml_response/'images/image').size.should == 1
+      (last_xml_response/'images/image').length.should == 1
       (last_xml_response/'images/image/architecture').first.text.should == 'x86_64'
     end
 
     def test_it_can_filter_using_unknown_architecture
       do_xml_request '/api/images', { :architecture => 'unknown_arch' }, true
-      (last_xml_response/'images/image').size.should == 0
+      (last_xml_response/'images/image').length.should == 0
     end
 
     def test_it_responses_to_json

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/instance_states_test.rb (from
r1005765, incubator/deltacloud/trunk/server/tests/instance_states_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/instance_states_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/instance_states_test.rb&p1=incubator/deltacloud/trunk/server/tests/instance_states_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/instance_states_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/instance_states_test.rb Fri Oct 
8 10:38:48 2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -14,14 +15,14 @@ module DeltacloudUnitTest
 
     def test_it_returns_instance_states
       do_xml_request '/api/instance_states', {}, true
-      (last_xml_response/'states/state').to_a.size.should > 0
+      (last_xml_response/'states/state').length.should > 0
     end
 
     def test_each_state_has_transition
       do_xml_request '/api/instance_states', {}, true
       (last_xml_response/'states/state').each do |state|
         next if state['name'].eql?('finish') # Finnish state doesn't have transitions
-        (state/'transition').to_a.size.should > 0
+        (state/'transition').length.should > 0
         (state/'transition').each do |transition|
           transition['to'].should_not == nil
         end

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/instances_test.rb (from r1005765,
incubator/deltacloud/trunk/server/tests/instances_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/instances_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/instances_test.rb&p1=incubator/deltacloud/trunk/server/tests/instances_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/instances_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/instances_test.rb Fri Oct  8 10:38:48
2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -14,7 +15,7 @@ module DeltacloudUnitTest
 
     def test_it_returns_instances
       do_xml_request '/api/instances', {}, true
-      (last_xml_response/'instances/instance').to_a.size.should > 0
+      (last_xml_response/'instances/instance').length.should > 0
     end
 
     def test_it_has_correct_attributes_set

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/realms_test.rb (from r1005765,
incubator/deltacloud/trunk/server/tests/realms_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/realms_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/realms_test.rb&p1=incubator/deltacloud/trunk/server/tests/realms_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/realms_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/realms_test.rb Fri Oct  8 10:38:48
2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest
@@ -14,7 +15,7 @@ module DeltacloudUnitTest
 
     def test_it_returns_realms
       do_xml_request '/api/realms', {}, true
-      (last_xml_response/'realms/realm').to_a.size.should > 0
+      (last_xml_response/'realms/realm').length.should > 0
     end
 
     def test_it_has_correct_attributes_set

Copied: incubator/deltacloud/trunk/server/tests/drivers/mock/url_for_test.rb (from r1005765,
incubator/deltacloud/trunk/server/tests/url_for_test.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/url_for_test.rb?p2=incubator/deltacloud/trunk/server/tests/drivers/mock/url_for_test.rb&p1=incubator/deltacloud/trunk/server/tests/url_for_test.rb&r1=1005765&r2=1005767&rev=1005767&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/url_for_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/url_for_test.rb Fri Oct  8 10:38:48
2010
@@ -1,3 +1,4 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
 module DeltacloudUnitTest



Mime
View raw message