You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2013/02/06 23:40:26 UTC

[2/3] git commit: CIMI unit tests: introduce helper read_data_file

CIMI unit tests: introduce helper read_data_file


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/7e83377a
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/7e83377a
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/7e83377a

Branch: refs/heads/master
Commit: 7e83377ac67ed8a9da97fe23907a9aee88e25157
Parents: afe372f
Author: David Lutterkort <lu...@redhat.com>
Authored: Wed Dec 19 16:09:46 2012 -0800
Committer: David Lutterkort <lu...@redhat.com>
Committed: Wed Feb 6 14:39:57 2013 -0800

----------------------------------------------------------------------
 server/tests/cimi/model/collection_spec.rb         |    4 ++--
 server/tests/cimi/model/credential_spec.rb         |    4 ++--
 .../tests/cimi/model/machine_configuration_spec.rb |    4 ++--
 server/tests/cimi/model/machine_image_spec.rb      |    4 ++--
 server/tests/cimi/model/machine_spec.rb            |    8 ++++----
 server/tests/cimi/model/machine_template_spec.rb   |    4 ++--
 .../tests/cimi/model/volume_configuration_spec.rb  |    4 ++--
 server/tests/cimi/model/volume_image_spec.rb       |    4 ++--
 server/tests/cimi/model/volume_spec.rb             |    4 ++--
 server/tests/cimi/model/volume_template_spec.rb    |    4 ++--
 server/tests/cimi/spec_helper.rb                   |    4 ++++
 11 files changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/collection_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/collection_spec.rb b/server/tests/cimi/model/collection_spec.rb
index 9e439ca..c33b091 100644
--- a/server/tests/cimi/model/collection_spec.rb
+++ b/server/tests/cimi/model/collection_spec.rb
@@ -35,8 +35,8 @@ describe "Collection class" do
 
   before do
     @models = ["m1", "m2"].map { |s| Model.new(:text => s) }
-    @xml = IO::read(File::join(DATA_DIR, "container.xml"))
-    @json = IO::read(File::join(DATA_DIR, "container.json"))
+    @xml = read_data_file("container.xml")
+    @json = read_data_file("container.json")
   end
 
   describe "XML serialization" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/credential_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/credential_spec.rb b/server/tests/cimi/model/credential_spec.rb
index 5f2df58..a0c4dc2 100644
--- a/server/tests/cimi/model/credential_spec.rb
+++ b/server/tests/cimi/model/credential_spec.rb
@@ -24,8 +24,8 @@ end
 describe "Credential model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "credential.xml"))
-    @json = IO::read(File::join(DATA_DIR, "credential.json"))
+    @xml = read_data_file("credential.xml")
+    @json = read_data_file("credential.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/machine_configuration_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_configuration_spec.rb b/server/tests/cimi/model/machine_configuration_spec.rb
index fbec2d4..8e36276 100644
--- a/server/tests/cimi/model/machine_configuration_spec.rb
+++ b/server/tests/cimi/model/machine_configuration_spec.rb
@@ -20,8 +20,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "MachineConfiguration model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "machine_configuration.xml"))
-    @json = IO::read(File::join(DATA_DIR, "machine_configuration.json"))
+    @xml = read_data_file("machine_configuration.xml")
+    @json = read_data_file("machine_configuration.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/machine_image_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_image_spec.rb b/server/tests/cimi/model/machine_image_spec.rb
index 005f966..a51f589 100644
--- a/server/tests/cimi/model/machine_image_spec.rb
+++ b/server/tests/cimi/model/machine_image_spec.rb
@@ -21,8 +21,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "MachineImage model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "machine_image.xml"))
-    @json = IO::read(File::join(DATA_DIR, "machine_image.json"))
+    @xml = read_data_file("machine_image.xml")
+    @json = read_data_file("machine_image.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/machine_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_spec.rb b/server/tests/cimi/model/machine_spec.rb
index 45a02fa..352b882 100644
--- a/server/tests/cimi/model/machine_spec.rb
+++ b/server/tests/cimi/model/machine_spec.rb
@@ -21,10 +21,10 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "Machine model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "machine.xml"))
-    @json = IO::read(File::join(DATA_DIR, "machine.json"))
-    @xml_minimal = IO::read(File::join(DATA_DIR, "machine-minimal.xml"))
-    @json_minimal = IO::read(File::join(DATA_DIR, "machine-minimal.json"))
+    @xml = read_data_file("machine.xml")
+    @json = read_data_file("machine.json")
+    @xml_minimal = read_data_file("machine-minimal.xml")
+    @json_minimal = read_data_file("machine-minimal.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/machine_template_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/machine_template_spec.rb b/server/tests/cimi/model/machine_template_spec.rb
index 5b0c87a..b1f6376 100644
--- a/server/tests/cimi/model/machine_template_spec.rb
+++ b/server/tests/cimi/model/machine_template_spec.rb
@@ -21,8 +21,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "MachineTemplate model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "machine_template.xml"))
-    @json = IO::read(File::join(DATA_DIR, "machine_template.json"))
+    @xml = read_data_file("machine_template.xml")
+    @json = read_data_file("machine_template.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/volume_configuration_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_configuration_spec.rb b/server/tests/cimi/model/volume_configuration_spec.rb
index cbbc9d0..cae4480 100644
--- a/server/tests/cimi/model/volume_configuration_spec.rb
+++ b/server/tests/cimi/model/volume_configuration_spec.rb
@@ -22,8 +22,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "Volume Configuration model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "volume_configuration.xml"))
-    @json = IO::read(File::join(DATA_DIR, "volume_configuration.json"))
+    @xml = read_data_file("volume_configuration.xml")
+    @json = read_data_file("volume_configuration.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/volume_image_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_image_spec.rb b/server/tests/cimi/model/volume_image_spec.rb
index c994b54..9b8b126 100644
--- a/server/tests/cimi/model/volume_image_spec.rb
+++ b/server/tests/cimi/model/volume_image_spec.rb
@@ -21,8 +21,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "Volume Image model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "volume_image.xml"))
-    @json = IO::read(File::join(DATA_DIR, "volume_image.json"))
+    @xml = read_data_file("volume_image.xml")
+    @json = read_data_file("volume_image.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/volume_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_spec.rb b/server/tests/cimi/model/volume_spec.rb
index e5eebd1..9345f48 100644
--- a/server/tests/cimi/model/volume_spec.rb
+++ b/server/tests/cimi/model/volume_spec.rb
@@ -21,8 +21,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "Volume model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "volume.xml"))
-    @json = IO::read(File::join(DATA_DIR, "volume.json"))
+    @xml = read_data_file("volume.xml")
+    @json = read_data_file("volume.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/model/volume_template_spec.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/model/volume_template_spec.rb b/server/tests/cimi/model/volume_template_spec.rb
index c8d04c8..3ecc960 100644
--- a/server/tests/cimi/model/volume_template_spec.rb
+++ b/server/tests/cimi/model/volume_template_spec.rb
@@ -21,8 +21,8 @@ require_relative '../spec_helper.rb' if require 'minitest/autorun'
 describe "Volume Template model" do
 
   before do
-    @xml = IO::read(File::join(DATA_DIR, "volume_template.xml"))
-    @json = IO::read(File::join(DATA_DIR, "volume_template.json"))
+    @xml = read_data_file("volume_template.xml")
+    @json = read_data_file("volume_template.json")
   end
 
   it "can be constructed from XML and JSON" do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7e83377a/server/tests/cimi/spec_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/spec_helper.rb b/server/tests/cimi/spec_helper.rb
index 8e86701..647a520 100644
--- a/server/tests/cimi/spec_helper.rb
+++ b/server/tests/cimi/spec_helper.rb
@@ -32,6 +32,10 @@ def parse_xml(xml, opts = {})
   XmlSimple.xml_in(xml, opts)
 end
 
+def read_data_file(name)
+  IO::read(File::join(DATA_DIR, name))
+end
+
 class HashCmp
 
   IGNORED_KEYS = [ "resourceURI" ]