@@ -146,7 +146,17 @@ def test_parse_own_packet_question(self):
146146 def test_parse_own_packet_response (self ):
147147 generated = r .DNSOutgoing (r ._FLAGS_QR_RESPONSE )
148148 generated .add_answer_at_time (
149- r .DNSService ("æøå.local." , r ._TYPE_SRV , r ._CLASS_IN , r ._DNS_HOST_TTL , 0 , 0 , 80 , "foo.local." ), 0
149+ r .DNSService (
150+ "æøå.local." ,
151+ r ._TYPE_SRV ,
152+ r ._CLASS_IN | r ._CLASS_UNIQUE ,
153+ r ._DNS_HOST_TTL ,
154+ 0 ,
155+ 0 ,
156+ 80 ,
157+ "foo.local." ,
158+ ),
159+ 0 ,
150160 )
151161 parsed = r .DNSIncoming (generated .packet ())
152162 self .assertEqual (len (generated .answers ), 1 )
@@ -166,13 +176,34 @@ def test_suppress_answer(self):
166176 question = r .DNSQuestion ("testname.local." , r ._TYPE_SRV , r ._CLASS_IN )
167177 query_generated .add_question (question )
168178 answer1 = r .DNSService (
169- "testname1.local." , r ._TYPE_SRV , r ._CLASS_IN , r ._DNS_HOST_TTL , 0 , 0 , 80 , "foo.local."
179+ "testname1.local." ,
180+ r ._TYPE_SRV ,
181+ r ._CLASS_IN | r ._CLASS_UNIQUE ,
182+ r ._DNS_HOST_TTL ,
183+ 0 ,
184+ 0 ,
185+ 80 ,
186+ "foo.local." ,
170187 )
171188 staleanswer2 = r .DNSService (
172- "testname2.local." , r ._TYPE_SRV , r ._CLASS_IN , r ._DNS_HOST_TTL / 2 , 0 , 0 , 80 , "foo.local."
189+ "testname2.local." ,
190+ r ._TYPE_SRV ,
191+ r ._CLASS_IN | r ._CLASS_UNIQUE ,
192+ r ._DNS_HOST_TTL / 2 ,
193+ 0 ,
194+ 0 ,
195+ 80 ,
196+ "foo.local." ,
173197 )
174198 answer2 = r .DNSService (
175- "testname2.local." , r ._TYPE_SRV , r ._CLASS_IN , r ._DNS_HOST_TTL , 0 , 0 , 80 , "foo.local."
199+ "testname2.local." ,
200+ r ._TYPE_SRV ,
201+ r ._CLASS_IN | r ._CLASS_UNIQUE ,
202+ r ._DNS_HOST_TTL ,
203+ 0 ,
204+ 0 ,
205+ 80 ,
206+ "foo.local." ,
176207 )
177208 query_generated .add_answer_at_time (answer1 , 0 )
178209 query_generated .add_answer_at_time (staleanswer2 , 0 )
@@ -444,7 +475,8 @@ def generate_host(zc, host_name, type_):
444475 out = r .DNSOutgoing (r ._FLAGS_QR_RESPONSE | r ._FLAGS_AA )
445476 out .add_answer_at_time (r .DNSPointer (type_ , r ._TYPE_PTR , r ._CLASS_IN , r ._DNS_OTHER_TTL , name ), 0 )
446477 out .add_answer_at_time (
447- r .DNSService (type_ , r ._TYPE_SRV , r ._CLASS_IN , r ._DNS_HOST_TTL , 0 , 0 , 80 , name ), 0
478+ r .DNSService (type_ , r ._TYPE_SRV , r ._CLASS_IN | r ._CLASS_UNIQUE , r ._DNS_HOST_TTL , 0 , 0 , 80 , name ),
479+ 0 ,
448480 )
449481 zc .send (out )
450482
@@ -487,7 +519,7 @@ def mock_incoming_msg(service_state_change: r.ServiceStateChange) -> r.DNSIncomi
487519 ttl = 0
488520
489521 generated .add_answer_at_time (
490- r .DNSPointer (service_type , r ._TYPE_PTR , r ._CLASS_IN | r . _CLASS_UNIQUE , ttl , service_name ), 0
522+ r .DNSPointer (service_type , r ._TYPE_PTR , r ._CLASS_IN , ttl , service_name ), 0
491523 )
492524 generated .add_answer_at_time (
493525 r .DNSService (
@@ -670,7 +702,7 @@ def test_incoming_ipv6(self):
670702 addr = "2606:2800:220:1:248:1893:25c8:1946" # example.com
671703 packed = socket .inet_pton (socket .AF_INET6 , addr )
672704 generated = r .DNSOutgoing (0 )
673- answer = r .DNSAddress ('domain' , r ._TYPE_AAAA , r ._CLASS_IN , 1 , packed )
705+ answer = r .DNSAddress ('domain' , r ._TYPE_AAAA , r ._CLASS_IN | r . _CLASS_UNIQUE , 1 , packed )
674706 generated .add_additional_answer (answer )
675707 packet = generated .packet ()
676708 parsed = r .DNSIncoming (packet )
@@ -886,6 +918,7 @@ def test_integration_with_listener_class(self):
886918 service_added = Event ()
887919 service_removed = Event ()
888920 service_updated = Event ()
921+ service_updated2 = Event ()
889922
890923 subtype_name = "My special Subtype"
891924 type_ = "_http._tcp.local."
@@ -902,7 +935,7 @@ def remove_service(self, zeroconf, type, name):
902935 service_removed .set ()
903936
904937 def update_service (self , zeroconf , type , name ):
905- pass
938+ service_updated2 . set ()
906939
907940 class MySubListener (r .ServiceListener ):
908941 def add_service (self , zeroconf , type , name ):
@@ -966,7 +999,7 @@ def update_service(self, zeroconf, type, name):
966999 assert info is not None
9671000 assert info .properties [b'prop_none' ] is False
9681001
969- # Begin material test addition
1002+ # test TXT record update
9701003 sublistener = MySubListener ()
9711004 zeroconf_browser .add_service_listener (registration_name , sublistener )
9721005 properties ['prop_blank' ] = b'an updated string'
@@ -981,7 +1014,6 @@ def update_service(self, zeroconf, type, name):
9811014 info = zeroconf_browser .get_service_info (type_ , registration_name )
9821015 assert info is not None
9831016 assert info .properties [b'prop_blank' ] == properties ['prop_blank' ]
984- # End material test addition
9851017
9861018 zeroconf_registrar .unregister_service (info_service )
9871019 service_removed .wait (1 )
@@ -1043,7 +1075,7 @@ def mock_incoming_msg(service_state_change: r.ServiceStateChange) -> r.DNSIncomi
10431075 ttl = 0
10441076
10451077 generated .add_answer_at_time (
1046- r .DNSPointer (service_type , r ._TYPE_PTR , r ._CLASS_IN | r . _CLASS_UNIQUE , ttl , service_name ), 0
1078+ r .DNSPointer (service_type , r ._TYPE_PTR , r ._CLASS_IN , ttl , service_name ), 0
10471079 )
10481080 generated .add_answer_at_time (
10491081 r .DNSService (
0 commit comments