1# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 2# 3# SPDX-License-Identifier: MPL-2.0 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, you can obtain one at https://mozilla.org/MPL/2.0/. 8# 9# See the COPYRIGHT file distributed with this work for additional 10# information regarding copyright ownership. 11 12import pytest 13 14pytest.importorskip("dns") 15import dns.message 16import dns.query 17import dns.rcode 18 19 20def test_async_hook(named_port): 21 msg = dns.message.make_query( 22 "example.com.", 23 "A", 24 ) 25 ans = dns.query.udp(msg, "10.53.0.1", timeout=10, port=named_port) 26 # the test-async plugin changes the status of any positive answer to NOTIMP 27 assert ans.rcode() == dns.rcode.NOTIMP 28