Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E6A30200B17 for ; Tue, 7 Jun 2016 02:41:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E52EC160A56; Tue, 7 Jun 2016 00:41:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 40CB2160A55 for ; Tue, 7 Jun 2016 02:41:38 +0200 (CEST) Received: (qmail 56382 invoked by uid 500); 7 Jun 2016 00:41:37 -0000 Mailing-List: contact notifications-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list notifications@libcloud.apache.org Received: (qmail 56371 invoked by uid 500); 7 Jun 2016 00:41:37 -0000 Delivered-To: apmail-libcloud-commits@libcloud.apache.org Received: (qmail 56339 invoked by uid 99); 7 Jun 2016 00:41:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jun 2016 00:41:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2DE90DFB93; Tue, 7 Jun 2016 00:41:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anthonyshaw@apache.org To: commits@libcloud.apache.org Date: Tue, 07 Jun 2016 00:41:37 -0000 Message-Id: <33dac44c5a364c9ab2c384fc53aec253@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] libcloud git commit: auroradns: Set 'priority' key in extra dict instead of 'prio'. archived-at: Tue, 07 Jun 2016 00:41:39 -0000 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 Authored: Mon Jun 6 16:09:34 2016 +0200 Committer: anthony-shaw 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