Skip to content

Commit

Permalink
update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
olofvndrhr committed Feb 29, 2024
1 parent 6e624a7 commit f38a103
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
12 changes: 6 additions & 6 deletions tests/test_escaple_semicolon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@

def test_escape1():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_value = r"v=TLSRPTv1\\; rua=mailto:[email protected]"
rcd_value = r"v=TLSRPTv1; rua=mailto:[email protected]"
value = nbdns._fix_semicolon(rcd_value, escape=True)

assert value == r"v=TLSRPTv1\; rua=mailto:[email protected]"


def test_escape2():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_value = r"v=TLSRPTv1; rua=mailto:[email protected]"
rcd_value = r"v=TLSRPTv1\; rua=mailto:[email protected]"
value = nbdns._fix_semicolon(rcd_value, escape=True)

assert value == r"v=TLSRPTv1\; rua=mailto:[email protected]"
assert value == r"v=TLSRPTv1\\; rua=mailto:[email protected]"


def test_escape3():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_value = r"t=y\;o=~\;"
value = nbdns._fix_semicolon(rcd_value, escape=True)

assert value == r"t=y\;o=~\;"
assert value == r"t=y\\;o=~\\;"


def test_escape4():
Expand All @@ -56,15 +56,15 @@ def test_unescape2():
rcd_value = r"v=TLSRPTv1\\; rua=mailto:[email protected]"
value = nbdns._fix_semicolon(rcd_value, escape=False)

assert value == r"v=TLSRPTv1; rua=mailto:[email protected]"
assert value == r"v=TLSRPTv1\; rua=mailto:[email protected]"


def test_unescape3():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_value = r"t=y\\;o=~\;"
value = nbdns._fix_semicolon(rcd_value, escape=False)

assert value == r"t=y;o=~;"
assert value == r"t=y\;o=~;"


def test_unescape4():
Expand Down
13 changes: 2 additions & 11 deletions tests/test_format_rdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_txt2():
rcd_value = r"v=TLSRPTv1\; rua=mailto:[email protected]"
value = nbdns._format_rdata(rcd_type, rcd_value)

assert value == r"v=TLSRPTv1\; rua=mailto:[email protected]"
assert value == r"v=TLSRPTv1\\; rua=mailto:[email protected]"


def test_txt3():
Expand All @@ -77,7 +77,7 @@ def test_txt4():
rcd_value = r"t=y\;o=~\;"
value = nbdns._format_rdata(rcd_type, rcd_value)

assert value == r"t=y\;o=~\;"
assert value == r"t=y\\;o=~\\;"


def test_txt5():
Expand All @@ -89,15 +89,6 @@ def test_txt5():
assert value == r"t=y\;o=~\;"


def test_txt4():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_type = "TXT"
rcd_value = r"v=TLSRPTv1\\; rua=mailto:[email protected]"
value = nbdns._format_rdata(rcd_type, rcd_value)

assert value == r"v=TLSRPTv1\; rua=mailto:[email protected]"


def test_srv():
nbdns = NetBoxDNSProvider(**DEFAULT_CONFIG)
rcd_type = "SRV"
Expand Down

0 comments on commit f38a103

Please sign in to comment.