Test SOA record in test_A()

This commit is contained in:
minecraftchest1@outlook.com 2025-01-27 10:21:07 -06:00
parent 18649b58dc
commit 5a689a6b71

View file

@ -2,7 +2,9 @@ import dnscode
import pytest import pytest
def test_A(tmp_path): def test_A(tmp_path):
zone = dnscode.Zone(origin='minecraftchest1.us') zone = dnscode.Zone(origin='minecraftchest1.us.')
zone.new_SOA(mname='ns1.minecraftchest1.us.', rname='admin.minecraftchest1.us.', serial=1, refresh=65535, retry=3600, ttl=3600)
# Test named and positional arguments. Ensure defaults work. # Test named and positional arguments. Ensure defaults work.
zone.new_A("1") zone.new_A("1")
@ -26,7 +28,8 @@ def test_A(tmp_path):
zone_file_1 = tmp_path / "test-A.zone" zone_file_1 = tmp_path / "test-A.zone"
zone.save_file(zone_file_1) zone.save_file(zone_file_1)
expected = """1.minecraftchest1.us. 3600 IN A 0.0.0.0 expected = """@ 3600 IN SOA ns1.minecraftchest1.us. admin.minecraftchest1.us. 1 65535 3600 15552000
1.minecraftchest1.us. 3600 IN A 0.0.0.0
2.minecraftchest1.us. 60 IN A 0.0.0.0 2.minecraftchest1.us. 60 IN A 0.0.0.0
3.minecraftchest1.us. 60 IN A 0.0.0.0 3.minecraftchest1.us. 60 IN A 0.0.0.0
@.minecraftchest1.us. 3600 IN A 0.0.0.0 @.minecraftchest1.us. 3600 IN A 0.0.0.0
@ -35,10 +38,11 @@ def test_A(tmp_path):
5.minecraftchest1.us. 120 IN A 0.0.0.0 5.minecraftchest1.us. 120 IN A 0.0.0.0
6.minecraftchest1.us. 3600 IN A 0.0.0.0 6.minecraftchest1.us. 3600 IN A 0.0.0.0
@.minecraftchest1.us. 60 IN A 0.0.0.0 @.minecraftchest1.us. 60 IN A 0.0.0.0
""" """
f = open(zone_file_1, "rt") f = open(zone_file_1, "rt")
assert expected == f.read() assert expected.strip() == f.read().strip()
############################################## ##############################################