def test_zonefiles_without_extension(self): # Windows doesn't let files end with a `.` so we add a .tst to them in # the repo and then try and create the `.` version we need for the # default case (no extension.) copyfile('./tests/zones/unit.tests.tst', './tests/zones/unit.tests.') # Unfortunately copyfile silently works and create the file without # the `.` so we have to check to see if it did that if exists('./tests/zones/unit.tests'): # It did so we need to skip this test, that means windows won't # have full code coverage, but skipping the test is going out of # our way enough for a os-specific/oddball case. self.skipTest('Unable to create unit.tests. (ending with .) so ' 'skipping default filename testing.') source = ZoneFileSource('test', './tests/zones') # Load zonefiles without a specified file extension valid = Zone('unit.tests.', []) source.populate(valid) self.assertEqual(15, len(valid.records))
def test_zonefiles_with_extension(self): source = ZoneFileSource('test', './tests/zones', '.extension') # Load zonefiles with a specified file extension valid = Zone('ext.unit.tests.', []) source.populate(valid) self.assertEqual(1, len(valid.records))