From e6a1724251362a118afb6409a007d8bb0c1321d2 Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Wed, 3 Aug 2016 11:45:57 -0400 Subject: [PATCH] fix flake8 failures --- onedns/resolver.py | 3 ++- onedns/tests/__init__.py | 2 +- onedns/tests/test_shell.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/onedns/resolver.py b/onedns/resolver.py index 94707d4..0362c40 100644 --- a/onedns/resolver.py +++ b/onedns/resolver.py @@ -32,6 +32,7 @@ class DynamicResolver(server.BaseResolver): reply = request.reply() qname = request.q.qname qtype = dnslib.QTYPE[request.q.qtype] + A_RECORDS = ['A', 'AAAA'] for name, rtype, rr in self.zone: # Check if label & type match if qname == name and (qtype in [rtype, 'ANY'] or rtype == 'CNAME'): @@ -40,7 +41,7 @@ class DynamicResolver(server.BaseResolver): # add in additional section if rtype in ['CNAME', 'NS', 'MX', 'PTR']: for a_name, a_rtype, a_rr in self.zone: - if a_name == rr.rdata.label and a_rtype in ['A', 'AAAA']: + if a_name == rr.rdata.label and a_rtype in A_RECORDS: reply.add_ar(a_rr) if not reply.rr: reply.header.rcode = dnslib.RCODE.NXDOMAIN diff --git a/onedns/tests/__init__.py b/onedns/tests/__init__.py index 1eb4355..9b16896 100644 --- a/onedns/tests/__init__.py +++ b/onedns/tests/__init__.py @@ -9,7 +9,7 @@ def scrub_auth(request): xml = StringIO.StringIO(request.body) tree = ET.parse(xml) root = tree.getroot() - auth_param = tree.findall('./params/param/value/string')[0] + auth_param = root.findall('./params/param/value/string')[0] auth_param.text = 'someuser:sometoken' scrubbed = StringIO.StringIO() tree.write(scrubbed) diff --git a/onedns/tests/test_shell.py b/onedns/tests/test_shell.py index a8dddd3..a5e4e6f 100644 --- a/onedns/tests/test_shell.py +++ b/onedns/tests/test_shell.py @@ -8,7 +8,7 @@ IPY = mock.MagicMock() IPY.embed = mock.MagicMock() IPY_MODULES = { - 'IPython': IPY, + 'IPython': IPY, }