diff options
| author | Bob Halley <halley@dnspython.org> | 2021-06-13 14:50:13 -0700 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2021-06-13 14:50:13 -0700 |
| commit | 5a9f9497ee379d1f58cf521d623fb9ebbc23ce17 (patch) | |
| tree | e19085b997b7b9a8fb80726a900993deafeaa7af /tests/test_zone.py | |
| parent | b4d71b40ba28db0a846084f10c35add18074a754 (diff) | |
| download | dnspython-5a9f9497ee379d1f58cf521d623fb9ebbc23ce17.tar.gz | |
Add want_origin parameter to zone to_text() and to_file().
[Issue #654]
Diffstat (limited to 'tests/test_zone.py')
| -rw-r--r-- | tests/test_zone.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_zone.py b/tests/test_zone.py index 26adc87..e8dd966 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -332,6 +332,34 @@ class ZoneTestCase(unittest.TestCase): os.unlink(here('example3.out')) self.assertTrue(ok) + def testToFileTextualWithOrigin(self): + z = dns.zone.from_file(here('example'), 'example') + try: + f = open(here('example4-textual.out'), 'w') + z.to_file(f, want_origin=True) + f.close() + ok = compare_files('testToFileTextualWithOrigin', + here('example4-textual.out'), + here('example4.good')) + finally: + if not _keep_output: + os.unlink(here('example4-textual.out')) + self.assertTrue(ok) + + def testToFileBinaryWithOrigin(self): + z = dns.zone.from_file(here('example'), 'example') + try: + f = open(here('example4-binary.out'), 'wb') + z.to_file(f, want_origin=True) + f.close() + ok = compare_files('testToFileBinaryWithOrigin', + here('example4-binary.out'), + here('example4.good')) + finally: + if not _keep_output: + os.unlink(here('example4-binary.out')) + self.assertTrue(ok) + def testFromText(self): z = dns.zone.from_text(example_text, 'example.', relativize=True) f = StringIO() |
