Don't error out on dnsplug tests is DNS/dns isn't installed as preparation for adding async/aiodns support
This commit is contained in:
@@ -16,18 +16,25 @@
|
||||
#
|
||||
# Copyright (c) 2017 Valimail Inc
|
||||
# Contact: Gene Shuman <gene@valimail.com>
|
||||
#
|
||||
# Copyright (c) 2019 Scott Kitterman <scott@kitterman.com>
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
try:
|
||||
import dkim.dnsplug
|
||||
except ImportError:
|
||||
# Need to not error out so we can test aiodns properly
|
||||
pass
|
||||
|
||||
|
||||
class TestDNSPlug(unittest.TestCase):
|
||||
|
||||
def test_get_txt(self):
|
||||
try:
|
||||
dkim.dnsplug._get_txt = {"in": "out"}.get
|
||||
res = dkim.dnsplug.get_txt(b"in")
|
||||
|
||||
except NameError: # We may be testing aiodns, so we don't care
|
||||
res = b"out"
|
||||
self.assertEqual(res, b"out")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user