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/18 01:23:27 UTC

svn commit: r1082766 - /incubator/libcloud/trunk/test/test_utils.py

Author: tomaz
Date: Fri Mar 18 00:23:26 2011
New Revision: 1082766

URL: http://svn.apache.org/viewvc?rev=1082766&view=rev
Log:
Add test for get_driver.

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

Modified: incubator/libcloud/trunk/test/test_utils.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_utils.py?rev=1082766&r1=1082765&r2=1082766&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_utils.py (original)
+++ incubator/libcloud/trunk/test/test_utils.py Fri Mar 18 00:23:26 2011
@@ -23,6 +23,8 @@ import os.path
 warnings.simplefilter('default')
 
 import libcloud.utils
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import DRIVERS
 
 WARNINGS_BUFFER = []
 
@@ -47,6 +49,19 @@ class TestUtils(unittest.TestCase):
 
         self.assertTrue(mimetype.find('python') != -1)
 
+    def test_get_driver(self):
+        driver = libcloud.utils.get_driver(drivers=DRIVERS,
+                                           provider=Provider.DUMMY)
+        self.assertTrue(driver is not None)
+
+        try:
+            driver = libcloud.utils.get_driver(drivers=DRIVERS,
+                                               provider='fooba')
+        except AttributeError:
+            pass
+        else:
+            self.fail('Invalid provider, but an exception was not thrown')
+
     def test_deprecated_warning(self):
         warnings.showwarning = show_warning