mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Avoid . on the end of files, but still test axfr default
This commit is contained in:
@@ -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.', [])
|
||||
|
||||
Reference in New Issue
Block a user