You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/03/14 16:01:35 UTC

svn commit: r1081410 - /incubator/libcloud/trunk/test/test_pricing.py

Author: tomaz
Date: Mon Mar 14 15:01:35 2011
New Revision: 1081410

URL: http://svn.apache.org/viewvc?rev=1081410&view=rev
Log:
Add new and fix existing pricing tests,

Modified:
    incubator/libcloud/trunk/test/test_pricing.py

Modified: incubator/libcloud/trunk/test/test_pricing.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_pricing.py?rev=1081410&r1=1081409&r2=1081410&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_pricing.py (original)
+++ incubator/libcloud/trunk/test/test_pricing.py Mon Mar 14 15:01:35 2011
@@ -33,9 +33,9 @@ class PricingTestCase(unittest.TestCase)
 
     def test_get_pricing_invalid_file_path(self):
         try:
-            get_pricing(driver_type='compute', driver_name='bar',
-                        pricing_file_path='inexistent.json')
-        except Exception:
+            libcloud.pricing.get_pricing(driver_type='compute', driver_name='bar',
+                                         pricing_file_path='inexistent.json')
+        except IOError:
             pass
         else:
             self.fail('Invalid pricing file path provided, but an exception was not'
@@ -43,14 +43,24 @@ class PricingTestCase(unittest.TestCase)
 
     def test_get_pricing_invalid_driver_type(self):
         try:
-            get_pricing(driver_type='invalid_type', driver_name='bar',
-                        pricing_file_path='inexistent.json')
-        except Exception:
+            libcloud.pricing.get_pricing(driver_type='invalid_type', driver_name='bar',
+                                         pricing_file_path='inexistent.json')
+        except AttributeError:
             pass
         else:
             self.fail('Invalid driver_type provided, but an exception was not'
                        ' thrown')
 
+    def test_get_pricing_not_in_cache(self):
+        try:
+            libcloud.pricing.get_pricing(driver_type='compute', driver_name='inexistent',
+                                         pricing_file_path='test/pricing_test.json')
+        except KeyError:
+            pass
+        else:
+            self.fail('Invalid driver provided, but an exception was not'
+                       ' thrown')
+
     def test_invalid_pricing_cache(self):
         libcloud.pricing.PRICING_DATA['compute']['foo'] = { 2: 2 }
         self.assertTrue('foo' in libcloud.pricing.PRICING_DATA['compute'])