Current File : //usr/lib/python3/dist-packages/twisted/names/test/__pycache__/test_srvconnect.cpython-312.pyc |
�
Ϫ�f�$ � � � d Z ddlZddlmZ ddlmZmZ ddlmZm Z ddl
mZ ddlm
Z
ddlmZmZmZ dd lmZ dd
lmZ ddlmZ G d� d
e� Z G d� dej2 � Z G d� dej6 � Zy)z-
Test cases for L{twisted.names.srvconnect}.
� N)�verifyObject)�defer�protocol)�DNSLookupError�ServiceNameUnknownError)�
IConnector)�
MemoryReactor)�client�dns�
srvconnect)�ResolverBase)�DNSNameError)�unittestc � � e Zd ZdZdd�Zd� Zy)�FakeResolvera�
Resolver that only gives out one given result.
Either L{results} or L{failure} must be set and will be used for
the return value of L{_lookup}
@ivar results: List of L{dns.RRHeader} for the desired result.
@type results: C{list}
@ivar failure: Failure with an exception from L{twisted.names.error}.
@type failure: L{Failure<twisted.python.failure.Failure>}
Nc �. � || _ || _ g | _ y �N)�results�failure�lookups)�selfr r s �D/usr/lib/python3/dist-packages/twisted/names/test/test_srvconnect.py�__init__zFakeResolver.__init__$ s � ���������� c �� � | j j ||||f� | j �"t j | j g g f� S t j
| j � S )z9
Return the result or failure on lookup.
)r �appendr r �succeed�failr )r �name�cls�qtype�timeouts r �_lookupzFakeResolver._lookup) sV � �
�����T�3��w�7�8��<�<�#��=�=�$�,�,��B�!7�8�8��:�:�d�l�l�+�+r )NN)�__name__�
__module__�__qualname__�__doc__r r# � r r r r s � �
��
,r r c � � e Zd ZdZd� Zd� Zy)�DummyFactoryzL
Dummy client factory that stores the reason of connection failure.
c � � d | _ y r ��reason�r s r r zDummyFactory.__init__9 s � ���r c � � || _ y r r, )r � connectorr- s r �clientConnectionFailedz#DummyFactory.clientConnectionFailed<