libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1209950 - in /libcloud/branches/py3k: libcloud/dns/drivers/zerigo.py test/dns/test_linode.py test/dns/test_rackspace.py test/dns/test_zerigo.py
Date Sat, 03 Dec 2011 17:08:02 GMT
Author: tomaz
Date: Sat Dec  3 17:08:01 2011
New Revision: 1209950

URL: http://svn.apache.org/viewvc?rev=1209950&view=rev
Log:
All the DNS tests now pass with Python 3.

Modified:
    libcloud/branches/py3k/libcloud/dns/drivers/zerigo.py
    libcloud/branches/py3k/test/dns/test_linode.py
    libcloud/branches/py3k/test/dns/test_rackspace.py
    libcloud/branches/py3k/test/dns/test_zerigo.py

Modified: libcloud/branches/py3k/libcloud/dns/drivers/zerigo.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/libcloud/dns/drivers/zerigo.py?rev=1209950&r1=1209949&r2=1209950&view=diff
==============================================================================
--- libcloud/branches/py3k/libcloud/dns/drivers/zerigo.py (original)
+++ libcloud/branches/py3k/libcloud/dns/drivers/zerigo.py Sat Dec  3 17:08:01 2011
@@ -20,7 +20,9 @@ __all__ = [
 
 import copy
 import base64
+
 from libcloud.py3 import httplib
+from libcloud.py3 import b
 
 from xml.etree import ElementTree as ET
 
@@ -114,7 +116,7 @@ class ZerigoDNSConnection(ConnectionUser
     responseCls = ZerigoDNSResponse
 
     def add_default_headers(self, headers):
-        auth_b64 = base64.b64encode('%s:%s' % (self.user_id, self.key))
+        auth_b64 = base64.b64encode(b('%s:%s' % (self.user_id, self.key)))
         headers['Authorization'] = 'Basic %s' % (auth_b64)
         return headers
 

Modified: libcloud/branches/py3k/test/dns/test_linode.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/dns/test_linode.py?rev=1209950&r1=1209949&r2=1209950&view=diff
==============================================================================
--- libcloud/branches/py3k/test/dns/test_linode.py (original)
+++ libcloud/branches/py3k/test/dns/test_linode.py Sat Dec  3 17:08:01 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.linode import LinodeException
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -74,7 +75,8 @@ class LinodeTests(unittest.TestCase):
         LinodeMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             self.driver.list_records(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -94,7 +96,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -203,7 +206,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -222,7 +226,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/branches/py3k/test/dns/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/dns/test_rackspace.py?rev=1209950&r1=1209949&r2=1209950&view=diff
==============================================================================
--- libcloud/branches/py3k/test/dns/test_rackspace.py (original)
+++ libcloud/branches/py3k/test/dns/test_rackspace.py Sat Dec  3 17:08:01 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.types import LibcloudError
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -88,7 +89,8 @@ class RackspaceUSTests(unittest.TestCase
         RackspaceMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             self.driver.list_records(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -107,7 +109,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -159,7 +162,8 @@ class RackspaceUSTests(unittest.TestCase
             self.driver.create_zone(domain='foo.bar.com', type='master',
                                     ttl=10,
                                     extra={'email': 'test@test.com'})
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEqual(str(e), 'Validation errors: Domain TTL is ' +
                                       'required and must be greater than ' +
                                       'or equal to 300')
@@ -231,7 +235,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -250,7 +255,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/branches/py3k/test/dns/test_zerigo.py
URL: http://svn.apache.org/viewvc/libcloud/branches/py3k/test/dns/test_zerigo.py?rev=1209950&r1=1209949&r2=1209950&view=diff
==============================================================================
--- libcloud/branches/py3k/test/dns/test_zerigo.py (original)
+++ libcloud/branches/py3k/test/dns/test_zerigo.py Sat Dec  3 17:08:01 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.types import InvalidCredsError, LibcloudError
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -82,7 +83,8 @@ class ZerigoTests(unittest.TestCase):
         ZerigoMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             list(self.driver.list_records(zone=zone))
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -101,7 +103,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -148,9 +151,9 @@ class ZerigoTests(unittest.TestCase):
         try:
             self.driver.create_zone(domain='foo.bar.com', type='master',
                                     ttl=10, extra=None)
-        except ZerigoError, e:
+        except ZerigoError:
+            e = sys.exc_info()[1]
             self.assertEqual(len(e.errors), 2)
-            pass
         else:
             self.fail('Exception was not thrown')
 
@@ -220,7 +223,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -239,7 +243,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')



Mime
View raw message