| 1 |
""" This is unittest file for parse methods in scenario.py """ |
| 2 |
import os |
| 3 |
|
| 4 |
from pydnstest.scenario import parse_config |
| 5 |
|
| 6 |
|
| 7 |
def test_parse_config__trust_anchor(): |
| 8 |
"""Checks if trust-anchors are separated into files according to domain.""" |
| 9 |
anchor1 = 'domain1.com.\t3600\tIN\tDS\t11901 7 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' |
| 10 |
anchor2 = 'domain2.net.\t3600\tIN\tDS\t59835 7 1 cccccccccccccccccccccccccccccccccccccccc' |
| 11 |
anchor3 = 'domain1.com.\t3600\tIN\tDS\t11902 7 1 1111111111111111111111111111111111111111' |
| 12 |
anchors = [['trust-anchor', f'"{anchor1}"'], |
| 13 |
['trust-anchor', f'"{anchor2}"'], |
| 14 |
['trust-anchor', f'"{anchor3}"']] |
| 15 |
args = (anchors, True, os.getcwd()) |
| 16 |
ta_files = parse_config(*args)["TRUST_ANCHOR_FILES"] |
| 17 |
assert sorted(ta_files.values()) == sorted([[anchor1, anchor3], [anchor2]]) |