Skip to content

Commit 3ed397b

Browse files
committed
cover
1 parent 71c410e commit 3ed397b

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

tests/test_handlers.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,21 +1125,32 @@ async def test_guard_against_low_ptr_ttl():
11251125

11261126

11271127
@pytest.mark.asyncio
1128-
async def test_duplicate_answers_in_packet():
1129-
"""Ensure we do not throw an exception when there are duplicate records in a packet."""
1128+
async def test_duplicate_goodbye_answers_in_packet():
1129+
"""Ensure we do not throw an exception when there are duplicate goodbye records in a packet."""
11301130
aiozc = AsyncZeroconf(interfaces=['127.0.0.1'])
11311131
zc = aiozc.zeroconf
11321132
answer_with_normal_ttl = r.DNSPointer(
11331133
"myservicelow_tcp._tcp.local.",
11341134
const._TYPE_PTR,
11351135
const._CLASS_IN | const._CLASS_UNIQUE,
11361136
const._DNS_OTHER_TTL,
1137-
'normal.local.',
1137+
'host.local.',
1138+
)
1139+
good_bye_answer = r.DNSPointer(
1140+
"myservicelow_tcp._tcp.local.",
1141+
const._TYPE_PTR,
1142+
const._CLASS_IN | const._CLASS_UNIQUE,
1143+
0,
1144+
'host.local.',
11381145
)
11391146
response = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
11401147
response.add_answer_at_time(answer_with_normal_ttl, 0)
1141-
response.add_answer_at_time(answer_with_normal_ttl, 0)
1142-
response.add_answer_at_time(answer_with_normal_ttl, 0)
1148+
incoming = r.DNSIncoming(response.packets()[0])
1149+
zc.record_manager.async_updates_from_response(incoming)
1150+
1151+
response = r.DNSOutgoing(const._FLAGS_QR_RESPONSE)
1152+
response.add_answer_at_time(good_bye_answer, 0)
1153+
response.add_answer_at_time(good_bye_answer, 0)
11431154
incoming = r.DNSIncoming(response.packets()[0])
11441155
zc.record_manager.async_updates_from_response(incoming)
11451156
await aiozc.async_close()

0 commit comments

Comments
 (0)