libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/2] libcloud git commit: auroradns: Set 'priority' key in extra dict instead of 'prio'.
Date Tue, 07 Jun 2016 00:41:37 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk c09c75732 -> 9fb9a9724


auroradns: Set 'priority' key in extra dict instead of 'prio'.

The AuroraDNS API returns the DNS record priority as the field 'prio',
but libcloud expects 'priority'.

In the AuroraDNS driver set the 'priority' key in the extra dictionary
when parsing return values from the AuroraDNS API.

Also add a additional test to verify this behavior.
Closes #804


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/69f9277e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/69f9277e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/69f9277e

Branch: refs/heads/trunk
Commit: 69f9277e438391ad90ceedb561fcdeee5f5aff1c
Parents: efff64f
Author: Wido den Hollander <wido@widodh.nl>
Authored: Mon Jun 6 16:09:34 2016 +0200
Committer: anthony-shaw <anthonyshaw@apache.org>
Committed: Tue Jun 7 10:35:17 2016 +1000

----------------------------------------------------------------------
 libcloud/dns/drivers/auroradns.py   |  2 +-
 libcloud/test/dns/test_auroradns.py | 28 +++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/69f9277e/libcloud/dns/drivers/auroradns.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/auroradns.py b/libcloud/dns/drivers/auroradns.py
index 658f99c..23e7f36 100644
--- a/libcloud/dns/drivers/auroradns.py
+++ b/libcloud/dns/drivers/auroradns.py
@@ -570,7 +570,7 @@ class AuroraDNSDriver(DNSDriver):
         extra['modified'] = record['modified']
         extra['disabled'] = record['disabled']
         extra['ttl'] = record['ttl']
-        extra['prio'] = record['prio']
+        extra['priority'] = record['prio']
 
         return Record(id=record['id'], name=name,
                       type=record['type'],

http://git-wip-us.apache.org/repos/asf/libcloud/blob/69f9277e/libcloud/test/dns/test_auroradns.py
----------------------------------------------------------------------
diff --git a/libcloud/test/dns/test_auroradns.py b/libcloud/test/dns/test_auroradns.py
index 278f76d..c8ab632 100644
--- a/libcloud/test/dns/test_auroradns.py
+++ b/libcloud/test/dns/test_auroradns.py
@@ -61,6 +61,32 @@ class AuroraDNSDriverTests(LibcloudTestCase):
             self.assertEqual(data[param], params[param])
             self.assertEqual(data['name'], 'localhost')
 
+    def test_res_to_record(self):
+        res = {'id': 2,
+               'name': 'www',
+               'type': 'AAAA',
+               'content': '2001:db8:100',
+               'created': 1234,
+               'modified': 2345,
+               'disabled': False,
+               'ttl': 1800,
+               'prio': 10}
+
+        zone = Zone(id=1,
+                    domain='example.com',
+                    type=None,
+                    ttl=60,
+                    driver=self.driver)
+
+        record = self.driver._AuroraDNSDriver__res_to_record(zone, res)
+        self.assertEqual(res['name'], record.name)
+        self.assertEqual(res['ttl'], record.extra['ttl'])
+        self.assertEqual(res['prio'], record.extra['priority'])
+        self.assertEqual(res['type'], record.type)
+        self.assertEqual(res['content'], record.data)
+        self.assertEqual(zone, record.zone)
+        self.assertEqual(self.driver, record.driver)
+
     def test_list_zones(self):
         zones = self.driver.list_zones()
         self.assertEqual(len(zones), 2)
@@ -98,7 +124,7 @@ class AuroraDNSDriverTests(LibcloudTestCase):
         self.assertEquals(record.data, '127.0.0.1')
         self.assertEquals(record.type, RecordType.A)
         self.assertEquals(record.extra['ttl'], 900)
-        self.assertEquals(record.extra['prio'], None)
+        self.assertEquals(record.extra['priority'], None)
 
     def test_update_record(self):
         ttl = 900


Mime
View raw message