deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 2/2] API TESTS: adds filtering by hwp/arch to images test
Date Thu, 09 Aug 2012 13:02:44 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 tests/deltacloud/images_test.rb |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tests/deltacloud/images_test.rb b/tests/deltacloud/images_test.rb
index 2c3af5c..1883b72 100644
--- a/tests/deltacloud/images_test.rb
+++ b/tests/deltacloud/images_test.rb
@@ -70,4 +70,29 @@ describe 'Deltacloud API Images collection' do
     end
   end
 
+
+  it 'should be able to filter images list by owner_id attribute' do
+    #get an image - either random or from "preferred" section of config.yaml:
+    image_id = get_a("image")
+    image = get(IMAGES+"/#{image_id}")
+    owner_id = (image.xml/"image/owner_id").text
+    filtered_image_list = get(IMAGES, {:owner_id=>owner_id})
+    #check owner_id of each:
+    (filtered_image_list.xml/"images/image").each do |img|
+      (img/"owner_id").text.must_equal owner_id
+    end
+  end
+
+  it 'should be able to filter images list by architecture attribute' do
+    #get an image - either random or from "preferred" section of config.yaml:
+    image_id = get_a("image")
+    image = get(IMAGES+"/#{image_id}")
+    arch = (image.xml/"image/architecture").text
+    filtered_image_list = get(IMAGES, {:architecture=>arch})
+    #check architecture of each:
+    (filtered_image_list.xml/"images/image").each do |img|
+      (img/"architecture").text.must_equal arch
+    end
+  end
+
 end
-- 
1.7.6.5


Mime
View raw message