Debian Codegraph @

dkim/tests/test_dnsplug.py

raw symbols SCIP
1 # This software is provided 'as-is', without any express or implied
2 # warranty. In no event will the author be held liable for any damages
3 # arising from the use of this software.
4 #
5 # Permission is granted to anyone to use this software for any purpose,
6 # including commercial applications, and to alter it and redistribute it
7 # freely, subject to the following restrictions:
8 #
9 # 1. The origin of this software must not be misrepresented; you must not
10 # claim that you wrote the original software. If you use this software
11 # in a product, an acknowledgment in the product documentation would be
12 # appreciated but is not required.
13 # 2. Altered source versions must be plainly marked as such, and must not be
14 # misrepresented as being the original software.
15 # 3. This notice may not be removed or altered from any source distribution.
16 #
17 # Copyright (c) 2017 Valimail Inc
18 # Contact: Gene Shuman <[email protected]>
19 # Copyright (c) 2019 Scott Kitterman <[email protected]>
20
21 import unittest
22 import sys
23 try:
24 import dkim.dnsplug
25 except ImportError:
26 # Need to not error out so we can test aiodns properly
27 pass
28
29
30 class TestDNSPlug(unittest.TestCase):
31
32 def test_get_txt(self):
33 try:
34 dkim.dnsplug._get_txt = {"in": "out"}.get
35 res = dkim.dnsplug.get_txt(b"in")
36 except NameError: # We may be testing aiodns, so we don't care
37 res = b"out"
38 self.assertEqual(res, b"out")
39
40
41 def test_suite():
42 from unittest import TestLoader
43 return TestLoader().loadTestsFromName(__name__)