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/09/25 23:33:55 UTC

svn commit: r1175585 - in /libcloud/trunk/test/dns: fixtures/linode/update_domain.json test_linode.py

Author: tomaz
Date: Sun Sep 25 21:33:55 2011
New Revision: 1175585

URL: http://svn.apache.org/viewvc?rev=1175585&view=rev
Log:
Add test for Linode DNS driver update_zone method.

Added:
    libcloud/trunk/test/dns/fixtures/linode/update_domain.json
Modified:
    libcloud/trunk/test/dns/test_linode.py

Added: libcloud/trunk/test/dns/fixtures/linode/update_domain.json
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/fixtures/linode/update_domain.json?rev=1175585&view=auto
==============================================================================
--- libcloud/trunk/test/dns/fixtures/linode/update_domain.json (added)
+++ libcloud/trunk/test/dns/fixtures/linode/update_domain.json Sun Sep 25 21:33:55 2011
@@ -0,0 +1,7 @@
+{
+   "ERRORARRAY":[],
+   "ACTION":"domain.update",
+   "DATA":{
+      "DomainID":5093
+   }
+}

Modified: libcloud/trunk/test/dns/test_linode.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/test_linode.py?rev=1175585&r1=1175584&r2=1175585&view=diff
==============================================================================
--- libcloud/trunk/test/dns/test_linode.py (original)
+++ libcloud/trunk/test/dns/test_linode.py Sun Sep 25 21:33:55 2011
@@ -48,7 +48,7 @@ class LinodeTests(unittest.TestCase):
         self.assertEqual(zone.type, 'master')
         self.assertEqual(zone.domain, 'linode.com')
         self.assertEqual(zone.ttl, None)
-        self.assertHasKeys(zone.extra, ['description', 'soa_email', 'status'])
+        self.assertHasKeys(zone.extra, ['description', 'SOA_Email', 'status'])
 
     def test_list_records_success(self):
         zone = self.driver.list_zones()[0]
@@ -82,7 +82,7 @@ class LinodeTests(unittest.TestCase):
         self.assertEqual(zone.type, 'master')
         self.assertEqual(zone.domain, 'linode.com')
         self.assertEqual(zone.ttl, None)
-        self.assertHasKeys(zone.extra, ['description', 'soa_email', 'status'])
+        self.assertHasKeys(zone.extra, ['description', 'SOA_Email', 'status'])
 
     def test_get_zone_does_not_exist(self):
         LinodeMockHttp.type = 'GET_ZONE_DOES_NOT_EXIST'
@@ -141,6 +141,25 @@ class LinodeTests(unittest.TestCase):
         else:
             self.fail('Exception was not thrown')
 
+    def test_update_zone_success(self):
+        zone = self.driver.list_zones()[0]
+        updated_zone = self.driver.update_zone(zone=zone,
+                                               domain='libcloud.org',
+                                               ttl=10,
+                                               extra={'SOA_Email':
+                                                      'bar@libcloud.org'})
+
+        self.assertEqual(zone.extra['SOA_Email'], 'dns@example.com')
+
+        self.assertEqual(updated_zone.id, zone.id)
+        self.assertEqual(updated_zone.domain, 'libcloud.org')
+        self.assertEqual(updated_zone.type, zone.type)
+        self.assertEqual(updated_zone.ttl, 10)
+        self.assertEqual(updated_zone.extra['SOA_Email'], 'bar@libcloud.org')
+        self.assertEqual(updated_zone.extra['status'], zone.extra['status'])
+        self.assertEqual(updated_zone.extra['description'],
+                         zone.extra['description'])
+
     def test_create_record_success(self):
         zone = self.driver.list_zones()[0]
         record = self.driver.create_record(name='www', zone=zone,
@@ -252,6 +271,10 @@ class LinodeMockHttp(MockHttp):
         body = self.fixtures.load('create_domain_validation_error.json')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _domain_update(self, method, url, body, headers):
+        body = self.fixtures.load('update_domain.json')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
     def _domain_resource_create(self, method, url, body, headers):
         body = self.fixtures.load('create_resource.json')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])