|
|
|
@ -9,6 +9,7 @@ import dns.zone |
|
|
|
from dns.exception import DNSException |
|
|
|
|
|
|
|
from mock import patch |
|
|
|
from shutil import copyfile |
|
|
|
from six import text_type |
|
|
|
from unittest import TestCase |
|
|
|
|
|
|
|
@ -21,7 +22,7 @@ from octodns.record import ValidationError |
|
|
|
class TestAxfrSource(TestCase): |
|
|
|
source = AxfrSource('test', 'localhost') |
|
|
|
|
|
|
|
forward_zonefile = dns.zone.from_file('./tests/zones/unit.tests.', |
|
|
|
forward_zonefile = dns.zone.from_file('./tests/zones/unit.tests.tst', |
|
|
|
'unit.tests', relativize=False) |
|
|
|
|
|
|
|
@patch('dns.zone.from_xfr') |
|
|
|
@ -44,7 +45,7 @@ class TestAxfrSource(TestCase): |
|
|
|
|
|
|
|
|
|
|
|
class TestZoneFileSource(TestCase): |
|
|
|
source = ZoneFileSource('test', './tests/zones') |
|
|
|
source = ZoneFileSource('test', './tests/zones', file_extension='tst') |
|
|
|
|
|
|
|
def test_zonefiles_with_extension(self): |
|
|
|
source = ZoneFileSource('test', './tests/zones', 'extension') |
|
|
|
@ -53,6 +54,14 @@ class TestZoneFileSource(TestCase): |
|
|
|
source.populate(valid) |
|
|
|
self.assertEquals(1, len(valid.records)) |
|
|
|
|
|
|
|
def test_zonefiles_without_extension(self): |
|
|
|
copyfile('./tests/zones/unit.tests.tst', './tests/zones/unit.tests.') |
|
|
|
source = ZoneFileSource('test', './tests/zones') |
|
|
|
# Load zonefiles without a specified file extension |
|
|
|
valid = Zone('unit.tests.', []) |
|
|
|
source.populate(valid) |
|
|
|
self.assertEquals(12, len(valid.records)) |
|
|
|
|
|
|
|
def test_populate(self): |
|
|
|
# Valid zone file in directory |
|
|
|
valid = Zone('unit.tests.', []) |
|
|
|
|