mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #664 from octodns/zonefile-ext-fix
Rename extention zonefile test to avoid existing unit.tests.
This commit is contained in:
@@ -229,14 +229,16 @@ class ZoneFileSource(AxfrBaseSource):
|
||||
self._zone_records = {}
|
||||
|
||||
def _load_zone_file(self, zone_name):
|
||||
|
||||
zone_filename = zone_name
|
||||
if self.file_extension:
|
||||
zone_filename = '{}{}'.format(zone_name,
|
||||
self.file_extension.lstrip('.'))
|
||||
|
||||
zonefiles = listdir(self.directory)
|
||||
if zone_name in zonefiles:
|
||||
if zone_filename in zonefiles:
|
||||
try:
|
||||
filename = zone_name
|
||||
if self.file_extension:
|
||||
filename = '{}{}'.format(zone_name,
|
||||
self.file_extension.lstrip('.'))
|
||||
z = dns.zone.from_file(join(self.directory, filename),
|
||||
z = dns.zone.from_file(join(self.directory, zone_filename),
|
||||
zone_name, relativize=False,
|
||||
check_origin=self.check_origin)
|
||||
except DNSException as error:
|
||||
|
||||
@@ -45,12 +45,12 @@ class TestAxfrSource(TestCase):
|
||||
|
||||
class TestZoneFileSource(TestCase):
|
||||
source = ZoneFileSource('test', './tests/zones')
|
||||
source_extension = ZoneFileSource('test', './tests/zones', 'extension')
|
||||
|
||||
def test_zonefiles_with_extension(self):
|
||||
source = ZoneFileSource('test', './tests/zones', 'extension')
|
||||
# Load zonefiles with a specified file extension
|
||||
valid = Zone('unit.tests.', [])
|
||||
self.source_extension.populate(valid)
|
||||
valid = Zone('ext.unit.tests.', [])
|
||||
source.populate(valid)
|
||||
self.assertEquals(1, len(valid.records))
|
||||
|
||||
def test_populate(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$ORIGIN unit.tests.
|
||||
@ 3600 IN SOA ns1.unit.tests. root.unit.tests. (
|
||||
$ORIGIN ext.unit.tests.
|
||||
@ 3600 IN SOA ns1.ext.unit.tests. root.ext.unit.tests. (
|
||||
2018071501 ; Serial
|
||||
3600 ; Refresh (1 hour)
|
||||
600 ; Retry (10 minutes)
|
||||
@@ -8,5 +8,5 @@ $ORIGIN unit.tests.
|
||||
)
|
||||
|
||||
; NS Records
|
||||
@ 3600 IN NS ns1.unit.tests.
|
||||
@ 3600 IN NS ns2.unit.tests.
|
||||
@ 3600 IN NS ns1.ext.unit.tests.
|
||||
@ 3600 IN NS ns2.ext.unit.tests.
|
||||
Reference in New Issue
Block a user