summaryrefslogtreecommitdiff
path: root/tests/test_zone.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2014-06-21 08:55:09 -0700
committerBob Halley <halley@dnspython.org>2014-06-21 08:57:20 -0700
commit5b32e65203731912aaa2067df55175c1bd5f8a8e (patch)
tree6f57a03fc549379d41649849751078a002764bc0 /tests/test_zone.py
parent482e38ed91da121416f551becd28096d559fb0b7 (diff)
downloaddnspython-5b32e65203731912aaa2067df55175c1bd5f8a8e.tar.gz
Add dns.zone.to_text() convenience method.
Thanks to Brandon Whaley <redkrieg@gmail.com> for the patch.
Diffstat (limited to 'tests/test_zone.py')
-rw-r--r--tests/test_zone.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_zone.py b/tests/test_zone.py
index 551530a..3b7c855 100644
--- a/tests/test_zone.py
+++ b/tests/test_zone.py
@@ -121,6 +121,20 @@ class ZoneTestCase(unittest.TestCase):
os.unlink('example2.out')
self.failUnless(ok)
+ def testToText(self):
+ z = dns.zone.from_file('example', 'example')
+ ok = False
+ try:
+ text_zone = z.to_text(nl='\x0a')
+ f = open('example3.out', 'wb')
+ f.write(text_zone)
+ f.close()
+ ok = filecmp.cmp('example3.out', 'example3.good')
+ finally:
+ if not _keep_output:
+ os.unlink('example3.out')
+ self.failUnless(ok)
+
def testFromText(self):
z = dns.zone.from_text(example_text, 'example.', relativize=True)
f = cStringIO.StringIO()