Repository: libcloud Updated Branches: refs/heads/trunk a2a36f030 -> a57c80831
auroradns: Properly parse TTL as extra data Small typo in the list caused this not to be parsed properly Closes #675 Signed-off-by: Tomaz Muraus <to...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a57c8083 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a57c8083 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a57c8083 Branch: refs/heads/trunk Commit: a57c8083104765856c33d5fa603f9458e774c4e3 Parents: a2a36f0 Author: Wido den Hollander <w...@widodh.nl> Authored: Thu Jan 7 16:55:49 2016 +0100 Committer: Tomaz Muraus <to...@apache.org> Committed: Fri Jan 8 14:08:06 2016 +0100 ---------------------------------------------------------------------- libcloud/dns/drivers/auroradns.py | 2 +- libcloud/test/dns/test_auroradns.py | 63 ++++++++++++++++++++++++++++++++ libcloud/test/secrets.py-dist | 1 + 3 files changed, 65 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/dns/drivers/auroradns.py ---------------------------------------------------------------------- diff --git a/libcloud/dns/drivers/auroradns.py b/libcloud/dns/drivers/auroradns.py index e5412e0..e051d0d 100644 --- a/libcloud/dns/drivers/auroradns.py +++ b/libcloud/dns/drivers/auroradns.py @@ -38,7 +38,7 @@ API_HOST = 'api.auroradns.eu' DEFAULT_ZONE_TTL = 3600 DEFAULT_ZONE_TYPE = 'master' -VALID_RECORD_PARAMS_EXTRA = ['ttl' 'prio', 'health_check_id', 'disabled'] +VALID_RECORD_PARAMS_EXTRA = ['ttl', 'prio', 'health_check_id', 'disabled'] class AuroraDNSResponse(JsonResponse): http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/test/dns/test_auroradns.py ---------------------------------------------------------------------- diff --git a/libcloud/test/dns/test_auroradns.py b/libcloud/test/dns/test_auroradns.py new file mode 100644 index 0000000..afd9b10 --- /dev/null +++ b/libcloud/test/dns/test_auroradns.py @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and + +import sys +import unittest + +from libcloud.dns.drivers.auroradns import AuroraDNSDriver +from libcloud.dns.types import RecordType +from libcloud.test import LibcloudTestCase, MockHttpTestCase +from libcloud.test.secrets import DNS_PARAMS_AURORADNS +from libcloud.test.file_fixtures import DNSFileFixtures + + +class AuroraDNSDriverTests(LibcloudTestCase): + + def setUp(self): + AuroraDNSDriver.connectionCls.conn_classes = \ + (None, AuroraDNSDriverMockHttp) + AuroraDNSDriverMockHttp.type = None + self.driver = AuroraDNSDriver(*DNS_PARAMS_AURORADNS) + + def test_merge_extra_data(self): + rdata = { + 'name': 'localhost', + 'type': RecordType.A, + 'content': '127.0.0.1' + } + + params = {'ttl': 900, + 'prio': 0, + 'health_check_id': None, + 'disabled': False} + + for param in params: + extra = { + param: params[param] + } + + data = self.driver._AuroraDNSDriver__merge_extra_data(rdata, + extra) + self.assertEqual(data['content'], '127.0.0.1') + self.assertEqual(data['type'], RecordType.A) + self.assertEqual(data[param], params[param]) + self.assertEqual(data['name'], 'localhost') + + +class AuroraDNSDriverMockHttp(MockHttpTestCase): + fixtures = DNSFileFixtures('auroradns') + + +if __name__ == '__main__': + sys.exit(unittest.main()) http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/test/secrets.py-dist ---------------------------------------------------------------------- diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist index cb0ab4a..dfc7a5b 100644 --- a/libcloud/test/secrets.py-dist +++ b/libcloud/test/secrets.py-dist @@ -80,3 +80,4 @@ DNS_PARAMS_ZONOMI = ('key') DNS_PARAMS_DURABLEDNS = ('api_user', 'api_key') DNS_PARAMS_GODADDY = ('customer-id', 'api_user', 'api_key') DNS_PARAMS_CLOUDFLARE = ('u...@example.com', 'key') +DNS_PARAMS_AURORADNS = ('apikey', 'secretkey')