Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/test/__pycache__/test_xmlrpc.cpython-312.pyc
�

Ϫ�fhw����dZddlZddlmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
mZddlmZmZmZmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZmZmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*	ed�dZ+Gd�dejZ�Z.Gd�de/�Z0Gd�de1�Z2Gd�de%�Z3Gd�de%�Z4Gd�de%�Z5Gd�d e3�Z6Gd!�d"e!jn�Z8Gd#�d$e!jL�Z9Gd%�d&e!jL�Z:Gd'�d(ejZ�Z;Gd)�d*e;�Z<Gd+�d,ejZ�Z=Gd-�d.�Z>Gd/�d0e>ejZ�Z?Gd1�d2e>ejZ�Z@Gd3�d4e;�ZAGd5�d6e;�ZBGd7�d8ejZ�ZCGd9�d:ejZ�ZDGd;�d<ejZ�ZEy#e,$rdZ+Y��awxYw)=z6
Tests for  XML-RPC support in L{twisted.web.xmlrpc}.
�N)�BytesIO�StringIO)�skipIf)�defer�reactor)�ConnectionDone)�EventLoggingObserver�
MemoryReactor)�FilteringLogObserver�LogLevel�LogLevelFilterPredicate�globalLogPublisher)�failure)�nativeString�
networkString)�namedModule)�unittest)�client�http�server�static�xmlrpc)�DummyRequest)�XMLRPC�QueryFactory�addIntrospection�payloadTemplate�withRequest�	xmlrpclibztwisted.internet.sslFTc�"�eZdZdZd�Zd�Zd�Zy)�AsyncXMLRPCTestsz5
    Tests for L{XMLRPC}'s support of Deferreds.
    c�&��tdg�|_d|j_ttdtjd�fz�|j_tj�x�|_
G�fd�dt�}|�|_y)N��POST�async�c���eZdZ�fd�Zy)�-AsyncXMLRPCTests.setUp.<locals>.AsyncResourcec����S�Nr&)�self�results ��>/usr/lib/python3/dist-packages/twisted/web/test/test_xmlrpc.py�xmlrpc_asyncz:AsyncXMLRPCTests.setUp.<locals>.AsyncResource.xmlrpc_async=s����
�N)�__name__�
__module__�__qualname__r.�r,s�r-�
AsyncResourcer(<s���
r/r4)
r�request�methodrrr�dumps�contentr�Deferredr,r�resource)r+r4r,s  @r-�setUpzAsyncXMLRPCTests.setUp3sp���#�R�D�)���$�����'��w�	����(;�<�<� 
����� %�~�~�/�/����	�F�	�&���
r/c��|jj|j�|j|jjg�|j
j
d�tjdj|jj��}|j|d�|j|jjd�y)z�
        If an L{XMLRPC} C{xmlrpc_*} method returns a L{defer.Deferred}, the
        response to the request is the result of that L{defer.Deferred}.
        r,r/)r3N�N)r:�renderr5�assertEqual�writtenr,�callbackr�loads�join�finished)r+�resps  r-�test_deferredResponsez&AsyncXMLRPCTests.test_deferredResponseBs���
	
�
�
���T�\�\�*�������-�-�r�2������X�&����s�x�x����(<�(<�=�>������2�3�������.�.��2r/c��|jj|j�|jjt	j
t
d���|jjd�|j|jjg�|j|jjd�y)a
        While waiting for the L{Deferred} returned by an L{XMLRPC} C{xmlrpc_*}
        method to fire, the connection the request was issued over may close.
        If this happens, neither C{write} nor C{finish} is called on the
        request.
        �	Simulatedr,rN)r:r>r5�processingFailedr�Failurerr,rAr?r@rD�r+s r-� test_interruptedDeferredResponsez1AsyncXMLRPCTests.test_interruptedDeferredResponsePs���	
�
�
���T�\�\�*����%�%�g�o�o�n�[�6Q�&R�S������X�&�������-�-�r�2�������.�.��2r/N)r0r1r2�__doc__r;rFrLr&r/r-r!r!.s���
(�3�3r/r!c��eZdZy)�TestRuntimeErrorN�r0r1r2r&r/r-rOrO^���r/rOc��eZdZy)�TestValueErrorNrPr&r/r-rSrSbrQr/rSc��eZdZdZdZdZd�Zd�Zgd�gd�ge_d�Z	gd	�ge	_d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zde_ed��Zd�Zy)�Test���*c��|Sr*r&)r+�args  r-�xmlrpc_echozTest.xmlrpc_echons���
r/c��||zS)z0
        This function add two numbers.
        r&)r+�a�bs   r-�
xmlrpc_addzTest.xmlrpc_addrs
���1�u�r/��intrara��doublercrcc�
�||gS)zC
        This function puts the two arguments in an array.
        r&)r+�string�nums   r-�xmlrpc_pairzTest.xmlrpc_pair~s����}�r/��arrayrerac�,�tj|�S)�Help for defer.)r�succeed�r+�xs  r-�xmlrpc_deferzTest.xmlrpc_defer�s���}�}�Q��r/c�<�tjt��Sr*)r�failrSrKs r-�xmlrpc_deferFailzTest.xmlrpc_deferFail�s���z�z�.�*�+�+r/c��t�r*)rOrKs r-�xmlrpc_failzTest.xmlrpc_fail�s���r/c�.�tjdd�S)N��hello�r�FaultrKs r-�xmlrpc_faultzTest.xmlrpc_fault�s���|�|�B��(�(r/c�T�tjtjdd��S)N��hi)rrqrryrKs r-�xmlrpc_deferFaultzTest.xmlrpc_deferFault�s���z�z�&�,�,�r�4�0�1�1r/c�@�d}||k7rtjdd�S|S)z8
        Used to test that we can pass Unicode.
        �☃�
zPayload not unicode snowmanrx)r+�payload�snowmans   r-�xmlrpc_snowmanzTest.xmlrpc_snowman�s(�����g���<�<��$A�B�B��r/c��dddggdd�S)Nr^�crv�foo�r]�Dr&rKs r-�xmlrpc_complexzTest.xmlrpc_complex�s���3��B�'�e�4�4r/c��||Sr*r&)r+�map�keys   r-�xmlrpc_dictzTest.xmlrpc_dict�s���3�x�r/�Help for dict.c�&�|jdz|zS)z�
        A method decorated with L{withRequest} which can be called by
        a test to verify that the request object really is passed as
        an argument.
        � )r6)r+r5�others   r-�xmlrpc_withRequestzTest.xmlrpc_withRequest�s$��
�N�N�
�
��	
�	
r/c���	tj||�S#tj$r3|j	d�r tj
|jd���wxYw)N�SESSIONzSession non-existent/expired.)r�lookupProcedurer�NoSuchFunction�
startswithry�SESSION_EXPIRED)r+�
procedurePaths  r-r�zTest.lookupProcedure�s_��	��)�)�$�
�>�>���$�$�	��'�'�	�2��l�l��(�(�*I����
	�s
��AAN)r0r1r2�FAILURE�	NOT_FOUNDr�r[r_�	signaturergrorrrtrzr~r�r�r��helprr�r�r&r/r-rUrUfs����G��I��O���	�&��J���8�8�K�� �,��)�2��5��(�K���

��

�	r/rUc��eZdZdZd�Zd�Zy)�TestLookupProcedurez}
    This is a resource which customizes procedure lookup to be used by the tests
    of support for this customization.
    c��|Sr*r&rms  r-�echozTestLookupProcedure.echo�s���r/c�l�|dk(r|jStj|jd|�d���)zs
        Lookup a procedure from a fixed set of choices, either I{echo} or
        I{system.listeMethods}.
        r�z
procedure z
 not found)r�rr�r�)r+�
procedureNames  r-r�z#TestLookupProcedure.lookupProcedure�s;��
�F�"��9�9���#�#��N�N�j���z�B�
�	
r/N)r0r1r2rMr�r�r&r/r-r�r��s���
�	
r/r�c��eZdZdZd�Zy)�TestListProceduresz�
    This is a resource which customizes procedure enumeration to be used by the
    tests of support for this customization.
    c��dgS)zW
        Return a list of a single method this resource will claim to support.
        r�r&rKs r-�listProceduresz!TestListProcedures.listProcedures�s���w�r/N)r0r1r2rMr�r&r/r-r�r��s���
r/r�c�"�eZdZdZd�Zd�Zd�Zy)�TestAuthHeaderzU
    This is used to get the header info so that we can test
    authentication.
    c�<�tj|�d|_yr*)rU�__init__r5rKs r-r�zTestAuthHeader.__init__�s���
�
�d����r/c�<�||_tj||�Sr*)r5rUr>)r+r5s  r-r>zTestAuthHeader.render�s������{�{�4��)�)r/c�j�|jj�|jj�fSr*)r5�getUser�getPasswordrKs r-�xmlrpc_authinfozTestAuthHeader.xmlrpc_authinfo�s'���|�|�#�#�%�t�|�|�'?�'?�'A�A�Ar/N)r0r1r2rMr�r>r�r&r/r-r�r��s���
�*�Br/r�c�"�eZdZdZd�Zd�Zd�Zy)�TestQueryProtocolz_
    QueryProtocol for tests that saves headers received and sent,
    inside the factory.
    c�x�|j|j_tjj	|�yr*)�	transport�factoryr�
QueryProtocol�connectionMaderKs r-r�z TestQueryProtocol.connectionMade�s&��!%����������+�+�D�1r/c�R�||jj|j�<yr*)r��headers�lower�r+r��vals   r-�handleHeaderzTestQueryProtocol.handleHeaders��,/������S�Y�Y�[�)r/c��||jj|j�<tjj|||�y)zA
        Keep sent headers so we can inspect them later.
        N)r��sent_headersr�rr��
sendHeaderr�s   r-r�zTestQueryProtocol.sendHeaders6��25����!�!�#�)�)�+�.����'�'��c�3�7r/N)r0r1r2rMr�r�r�r&r/r-r�r��s���
2�0�8r/r�c��eZdZdZeZd�Zy)�TestQueryFactoryzE
    QueryFactory using L{TestQueryProtocol} for saving headers.
    c�f�i|_i|_tjj|g|��i|��yr*)r�r�rrr�)r+�args�kwargss   r-r�zTestQueryFactory.__init__s/�����������$�$�T�;�D�;�F�;r/N)r0r1r2rMr��protocolr�r&r/r-r�r�s���!�H�<r/r�c��eZdZdZd�Zy)�TestQueryFactoryCancelz{
    QueryFactory that saves a reference to the
    L{twisted.internet.interfaces.IConnector} to test connection lost.
    c��||_yr*)�	connector)r+r�s  r-�startedConnectingz(TestQueryFactoryCancel.startedConnecting!s	��"��r/N)r0r1r2rMr�r&r/r-r�r�s���
#r/r�c��eZdZd�Zd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zeed�d��Zy)�XMLRPCTestsc���tjdtjt	��d��|_|j
j
�j|_g|_y�Nr�	127.0.0.1��	interface)	r�	listenTCPr�SiterU�p�getHost�port�	factoriesrKs r-r;zXMLRPCTests.setUp&sB���"�"�1�f�k�k�$�&�&9�[�Q����F�F�N�N�$�)�)��	���r/c�D�g|_|jj�Sr*)r�r��
stopListeningrKs r-�tearDownzXMLRPCTests.tearDown+s������v�v�#�#�%�%r/c�R�t|i|��}|jj|�|S)zw
        Specific queryFactory for proxy that uses our custom
        L{TestQueryFactory}, and save factories.
        )r�r��append)r+r�r�r�s    r-�queryFactoryzXMLRPCTests.queryFactory/s*��
#�D�3�F�3�������g�&��r/Nc��tjtd|jz��}|�|j|_|S||_|S)z�
        Return a new xmlrpc.Proxy for the test site created in
        setUp(), using the given factory as the queryFactory, or
        self.queryFactory if no factory is provided.
        �http://127.0.0.1:%d/�r�Proxyrr�r��r+r�r�s   r-�proxyzXMLRPCTests.proxy8sH��
�L�L��'=��	�	�'I�J�K���?�!�.�.�A�N���%�A�N��r/c�"�dddddidfdfddddgfdd	d
ddd
ggdd�fg}g}|D]T\}}}|j�j|g|���}|j|j|�|j	|��Vtj|d��S)N)�add)���)r)r]r]�dictr]r=�pair)r]r=)r�r�r��complexr&r^r�rvr�r�T��fireOnOneErrback�r��
callRemote�addCallbackr?r�r�DeferredList)r+�inputOutput�dl�methr��outp�ds       r-�test_resultszXMLRPCTests.test_resultsEs����"�
�s�A�h��_�a�(�
�X��Q�x�(�-�
��3��R��"4�5�A�B�

���� +�	��D�$��'��
�
��'�'��4�t�4�A�
�M�M�$�*�*�D�1��I�I�a�L�	��!�!�"�t�<�<r/c����j�jdd�}�fd�}�fd�}|j|�|j|�|S)z�
        Verify that headers sent from the client side and the ones we
        get back from the server side are correct.

        r�r�c����j�jdjdd��j�jdjdd�y)Nr�content-type�text/xml; charset=utf-8�content-lengths129)r?r�r�)�ingr+s �r-�check_server_headersz6XMLRPCTests.test_headers.<locals>.check_server_headers^sR���������q�!�)�)�/�:�<V�
�
���T�^�^�A�.�6�6�7H�I�6�Rr/c����j�jdjdd��j�jdjdd��j�jdjdd�y)Nrs
user-agentsTwisted/XMLRPClibr�r�r�s155)r?r�r�)�ignr+s �r-�check_client_headersz6XMLRPCTests.test_headers.<locals>.check_client_headersds}���������q�!�.�.�}�=�?S�
�
������q�!�.�.��?�*�
�
���T�^�^�A�.�;�;�<M�N�PV�Wr/�r�r�r�)r+r�rrs`   r-�test_headerszXMLRPCTests.test_headersVsJ���
�J�J�L�#�#�I�x�8��	S�	X�	
�
�
�*�+�	�
�
�*�+��r/c�����t��t�ttj��g��tj���j�fd��g}dD]k\}}�j�j|�}�j|tj�}|j|f�fd�	�|j|��mtj |d��}��fd�}|j|�|S)z�
        Verify that for each way a method exposed via XML-RPC can fail, the
        correct 'Content-type' header is set in the response and that the
        client-side Deferred is errbacked with an appropriate C{Fault}
        instance.
        ��defaultLogLevelc�.��tj��Sr*�r�removeObserver��filtereds�r-�<lambda>z)XMLRPCTests.test_errors.<locals>.<lambda>~���� 2� A� A�(� K�r/))rVrq)rV�	deferFail)rv�fault)rW�noSuchMethod)r|�
deferFault)rX�SESSION_TESTc�<���j|j|�Sr*)r?�	faultCode)�exc�coder+s  �r-rz)XMLRPCTests.test_errors.<locals>.<lambda>�s����1A�1A�#�-�-�QU�1V�r/Tr�c����jD]!}�j|jdd��#�jdt	����ddj
}�ddj
}t
|t�r�j|t�n,�j|t��j|t��jtt�y)Nr�r�r�r�log_failurer=)r�r?r��assertEquals�len�value�
isinstancerS�assertIsInstancerO�flushLoggedErrors)rr��f1�f2�logObserverr+s    ��r-�cbz#XMLRPCTests.test_errors.<locals>.cb�s�����>�>�
��� � ��O�O�O�4�6P��
�
���a��[�!1�2��Q��
�.�4�4�B��Q��
�.�4�4�B��"�n�-��%�%�b�*:�;��%�%�b�*:�;��%�%�b�.�9��"�"�#3�^�Dr/)r	rr
r�criticalr�addObserver�
addCleanupr�r��
assertFailurerryr�r�rr�)r+r�r�
methodNamer�r$r
r#s`     @@r-�test_errorszXMLRPCTests.test_errorsrs����+�,��'��1�(�BS�BS�T�U�
��	�&�&�x�0����K�L�
��!
�	��D�*��
�
��'�'�
�3�A��"�"�1�f�l�l�3�A�
�M�M�4�V�W��I�I�a�L�	�
���r�D�9��	E�"	
�
�
�b���r/c�v���fd��|j��jddd�}|j�jjj
d�|j
�|j�jjj
d�|j|tj�}|S)z�
        A deferred from the Proxy can be cancelled, disconnecting
        the L{twisted.internet.interfaces.IConnector}.
        c�<��t|i|���_�jSr*)r��f)r��kwr�s  �r-r�z(XMLRPCTests.test_cancel.<locals>.factory�s���.��;��;�G�I��9�9�r/r�r�r��disconnected)r�r��assertNotEqualr-r��state�cancelr?r(r�CancelledError)r+r�r�s  @r-�test_cancelzXMLRPCTests.test_cancel�s����	�
�J�J�w��*�*�5�!�Q�7�����G�I�I�/�/�5�5�~�F�	���
�������,�,�2�2�N�C����q�%�"6�"6�7���r/c���tjt�}|jdt	d�j
fz��}�fd�}|j
|�|S)zN
        A classic GET on the xml server should return a NOT_ALLOWED.
        sGETr�c�Z���j|jtj�yr*)r?rr�NOT_ALLOWED)�responser+s �r-�
checkResponsez0XMLRPCTests.test_errorGet.<locals>.checkResponse�s������X�]�]�D�,<�,<�=r/)r�Agentrr5rr�r�)r+�agentr�r9s`   r-�
test_errorGetzXMLRPCTests.test_errorGet�sL������W�%���M�M�&�-�0F�$�)�)��0U�"V�W��	>�	
�
�
�m�$��r/c	�2��tjt�}|jt	d�j
fz�dtjtd����}|jtj��fd�}|j|�|S)zL
        Test that an invalid XML input returns an L{xmlrpc.Fault}.
        r�sPOSTsfoo)�urir6�bodyProducerc�d���jtjtj|�yr*)�assertRaisesrryrrB)r,r+s �r-r$z,XMLRPCTests.test_errorXMLContent.<locals>.cb�s������f�l�l�I�O�O�V�Dr/)
rr:rr5rr��FileBodyProducerrr��readBody)r+r;r�r$s`   r-�test_errorXMLContentz XMLRPCTests.test_errorXMLContent�sz������W�%���M�M��4��	�	�|�C�D���0�0����A�
�
��
	
�
�
�f�o�o�&�	E�	
�
�
�b���r/c��tj�}|j�jd|�}|j	|j
|�|S)z�
        If an L{xmlrpclib.DateTime} is passed as an argument to an XML-RPC
        call and then returned by the server unmodified, the result should
        be equal to the original object.
        r�)r�DateTimer�r�r�r?)r+�whenr�s   r-�test_datetimeRoundtripz"XMLRPCTests.test_datetimeRoundtrip�sC���!�!�#���J�J�L�#�#�F�D�1��	�
�
�d�&�&��-��r/c�����t��t�ttj��g��tj���j�fd���j�jdd�}d�}�jtd|��j|t�}��fd�}|j|�|S)a.
        If it is not possible to encode a response to the request (for example,
        because L{xmlrpclib.dumps} raises an exception when encoding a
        L{Fault}) the exception which prevents the response from being
        generated is logged and the request object is finished anyway.
        rc�.��tj��Sr*r
rs�r-rz6XMLRPCTests.test_doubleEncodingError.<locals>.<lambda>�rr/r�r#c��td��)NzCannot encode anything at all!)�RuntimeError)r�r�s  r-�	fakeDumpsz7XMLRPCTests.test_doubleEncodingError.<locals>.fakeDumps�s���?�@�@r/r7c�����jdt����j�ddjt��jt�j
t��d�y)Nr=rr)rrrrrLr?r )�ignoredr#r+s ��r-�cbFailedz6XMLRPCTests.test_doubleEncodingError.<locals>.cbFailed�sW������a��[�!1�2��!�!�+�a�.��"?�"E�"E�|�T����S��!7�!7��!E�F��Jr/)r	rr
rr%rr&r'r�r��patchrr(�	Exceptionr�)r+r�rMrPr
r#s`   @@r-�test_doubleEncodingErrorz$XMLRPCTests.test_doubleEncodingError�s����+�,��'��1�(�BS�BS�T�U�
��	�&�&�x�0����K�L��J�J�L�#�#�F�B�/��	A�	
�
�
�9�g�y�1�

���q�)�,��	K�	
�
�
�h���r/c�p���j�jdd�}�fd�}|j|�S)zV
        The connection to the web server is closed when the request is done.
        r�r#c����j\}�j|jj��j	|jj
�yr*)r��assertFalser��	connected�
assertTruer/)rOr�r+s  �r-�responseDonezBXMLRPCTests.test_closeConnectionAfterRequest.<locals>.responseDones@������I�W����W�.�.�8�8�9��O�O�G�-�-�:�:�;r/r)r+r�rYs`  r-� test_closeConnectionAfterRequestz,XMLRPCTests.test_closeConnectionAfterRequests3���
�J�J�L�#�#�F�B�/��	<�
�}�}�\�*�*r/c��t�}tjdd|��}|jd�|j	|j
ddd�y)z�
        For I{HTTP} URIs, L{xmlrpc.Proxy.callRemote} passes the value it
        received for the C{connectTimeout} parameter as the C{timeout} argument
        to the underlying connectTCP call.
        shttp://127.0.0.1:69g@��connectTimeoutr�
someMethodrr�N)r
rr�r�r?�
tcpClients�r+rr�s   r-�test_tcpTimeoutzXMLRPCTests.test_tcpTimeout
sP�� �/�����"�3��
��	����&�����+�+�A�.�q�1�3�7r/zOpenSSL not presentc��t�}tjdd|��}|jd�|j	|j
ddd�y)z�
        For I{HTTPS} URIs, L{xmlrpc.Proxy.callRemote} passes the value it
        received for the C{connectTimeout} parameter as the C{timeout} argument
        to the underlying connectSSL call.
        shttps://127.0.0.1:69g@r\r^r�N)r
rr�r�r?�
sslClientsr`s   r-�test_sslTimeoutzXMLRPCTests.test_sslTimeoutsP�� �/�����#�C��
��	����&�����+�+�A�.�q�1�3�7r/r*)r0r1r2r;r�r�r�r�rr*r4r<rDrHrSrZrar�sslSkiprer&r/r-r�r�%sf���
&���=�"�8.�`�"��$	�!�F+�8��G�*�+�8�,�8r/r�c��eZdZdZdd�Zy)�XMLRPCProxyWithoutSlashTestsz3
    Test with proxy that doesn't add a slash.
    Nc��tjtd|jz��}|�|j|_|S||_|S)N�http://127.0.0.1:%dr�r�s   r-r�z"XMLRPCProxyWithoutSlashTests.proxy.sF���L�L��'<�t�y�y�'H�I�J���?�!�.�.�A�N���%�A�N��r/r*)r0r1r2rMr�r&r/r-rhrh)s���r/rhc�(�eZdZdZd�Zd�Zd�Zd�Zy)� XMLRPCPublicLookupProcedureTestszr
    Tests for L{XMLRPC}'s support of subclasses which override
    C{lookupProcedure} and C{listProcedures}.
    c�`�tjdtj|�d��|_|j|jj�|jj�j|_tjtd|jz��|_y)Nrr�r�rj)
rr�rr�r�r'r�r�r�rr�rr�)r+r:s  r-�createServerz-XMLRPCPublicLookupProcedureTests.createServer=sn���"�"�1�f�k�k�(�&;�{�S���������,�,�-��F�F�N�N�$�)�)��	��\�\�-�0E��	�	�0Q�"R�S��
r/c��|jt��d}|jjd|�}|j	|j
|�|S)z�
        A subclass of L{XMLRPC} can override C{lookupProcedure} to find
        procedures that are not defined using a C{xmlrpc_}-prefixed method name.
        rwr�)rnr�r�r�r�r?)r+�whatr�s   r-�test_lookupProcedurez5XMLRPCPublicLookupProcedureTests.test_lookupProcedureCsJ��
	
���-�/�0����J�J�!�!�&�$�/��	�
�
�d�&�&��-��r/c��|jt��|jjdd�}|j	|t
j�}|S)z�
        A subclass of L{XMLRPC} can override C{lookupProcedure} to raise
        L{NoSuchFunction} to indicate that a requested method is not available
        to be called, signalling a fault to the XML-RPC client.
        �xxxxrw)rnr�r�r�r(rry�r+r�s  r-r*z,XMLRPCPublicLookupProcedureTests.test_errorsNsG��	
���-�/�0��J�J�!�!�&�'�2�����q�&�,�,�/���r/c���t�}t|��j|��jj	d�}�fd�}|j|�|S)z�
        A subclass of L{XMLRPC} can override C{listProcedures} to define
        Overriding listProcedures should prevent introspection from being
        broken.
        �system.listMethodsc�*���jd|�y)Nr�)�assertIn)�
proceduresr+s �r-�listedzAXMLRPCPublicLookupProcedureTests.test_listMethods.<locals>.listedds���
�M�M�%��,r/)r�rrnr�r�r�)r+r:r�rzs`   r-�test_listMethodsz1XMLRPCPublicLookupProcedureTests.test_listMethodsYsP���&�'����"����(�#��J�J�!�!�"6�7��	-�	
�
�
�f���r/N)r0r1r2rMrnrqr*r{r&r/r-rlrl7s���
T�	�	�r/rlc�"�eZdZdZd�Zd�Zd�Zy)�SerializationConfigMixinas
    Mixin which defines a couple tests which should pass when a particular flag
    is passed to L{XMLRPC}.

    These are not meant to be exhaustive serialization tests, since L{xmlrpclib}
    does all of the actual serialization work.  They are just meant to exercise
    a few codepaths to make sure we are calling into xmlrpclib correctly.

    @ivar flagName: A C{str} giving the name of the flag which must be passed to
        L{XMLRPC} to allow the tests to pass.  Subclasses should set this.

    @ivar value: A value which the specified flag will allow the serialization
        of.  Subclasses should set this.
    c
��|jdi}tjdtjtdi|���d��|_|j|jj�|jj�j|_
tjtd|jfz�fi|��|_y)zO
        Create a new XML-RPC server with C{allowNone} set to C{True}.
        Trr�r�r�Nr&)�flagNamerr�rr�rUr�r'r�r�r�rr�rr�)r+r�s  r-r;zSerializationConfigMixin.setUp~s����-�-��&���"�"�
�v�{�{�4�>�&�>�*�k�
���	
������,�,�-��F�F�N�N�$�)�)��	��\�\��0�D�I�I�<�?�@�
�DJ�
��
r/c��|jjd|j�}|j|j|j�|S)zY
        C{self.value} can be round-tripped over an XMLRPC method call/response.
        r�r�r�rr�r?rts  r-�test_roundtripValuez,SerializationConfigMixin.test_roundtripValue�s;��
�J�J�!�!�'�4�:�:�6��	�
�
�d�&�&��
�
�3��r/c��|jjdd|ji�}|j|jd|ji�|S)zz
        A C{dict} which contains C{self.value} can be round-tripped over an
        XMLRPC method call/response.
        rr]r�rts  r-�test_roundtripNestedValuez2SerializationConfigMixin.test_roundtripNestedValue�sE��

�J�J�!�!�'�C����+<�=��	�
�
�d�&�&��d�j�j�(9�:��r/N)r0r1r2rMr;r�r�r&r/r-r}r}ns��
�
��r/r}c��eZdZdZdZdZy)�XMLRPCAllowNoneTestszF
    Tests for passing L{None} when the C{allowNone} flag is set.
    �	allowNoneN)r0r1r2rMrrr&r/r-r�r��s����H��Er/r�c�B�eZdZdZdZej
dddddd�Zy	)
�XMLRPCUseDateTimeTestszd
    Tests for passing a C{datetime.datetime} instance when the C{useDateTime}
    flag is set.
    �useDateTimei�rv�r��-�;N)r0r1r2rMr�datetimerr&r/r-r�r��s*���
�H��H���d�B��A�r�2�6�Er/r�c�6�eZdZdZdZdZd�Zd�Zd�Zd�Z	d�Z
y	)
�XMLRPCAuthenticatedTestsz]
    Test with authenticated proxy. We run this with the same input/output as
    above.
    susernamesasecretc���tjdtjt	��d��|_|j
j
�j|_g|_yr�)	rr�rr�r�r�r�r�r�rKs r-r;zXMLRPCAuthenticatedTests.setUp�sH���"�"�
�v�{�{�>�+�,��
����F�F�N�N�$�)�)��	���r/c�8�dt|j�t|j�|jfz}t	j
t
|��}|jd�}|j|j|j|jg�|S)Nzhttp://%s:%s@127.0.0.1:%d/�authinfo)
r�user�passwordr�rr�rr�r�r?)r+�urlr�r�s    r-�test_authInfoInURLz+XMLRPCAuthenticatedTests.test_authInfoInURL�sy��*�����#�����'��I�I�.
�
��

�L�L��s�+�,��
�L�L��$��	�
�
�d�&�&����D�M�M�(B�C��r/c��tjtd|jfz�|j|j
�}|j
d�}|j|j|j|j
g�|S)Nr�r��	rr�rr�r�r�r�r�r?�r+r�r�s   r-�test_explicitAuthInfoz.XMLRPCAuthenticatedTests.test_explicitAuthInfo�sh���L�L��0�D�I�I�<�?�@��I�I��M�M�
��

�L�L��$��	�
�
�d�&�&����D�M�M�(B�C��r/c��|jdz}tjtd|jfz�|j
|�}|j
d�}|j|j|j
|g�|S)z�
        C{QueryProtocol} uses the C{base64.b64encode} function to encode user
        name and password in the I{Authorization} header, so that it doesn't
        embed new lines when using long inputs.
        �(r�r�)	r�rr�rr�r�r�r�r?)r+�longPasswordr�r�s    r-�test_longPasswordz*XMLRPCAuthenticatedTests.test_longPassword�sp���}�}�r�)���L�L��0�D�I�I�<�?�@��I�I��
��

�L�L��$��	�
�
�d�&�&����L�(A�B��r/c��tjtd|jfz�|j|j
�}|j
d�}|j|j|j|j
g�|S)Nzhttp://wrong:info@127.0.0.1:%d/r�r�r�s   r-�test_explicitAuthInfoOverridez6XMLRPCAuthenticatedTests.test_explicitAuthInfoOverride�sh���L�L��;�t�y�y�l�J�K��I�I��M�M�
��

�L�L��$��	�
�
�d�&�&����D�M�M�(B�C��r/N)r0r1r2rMr�r�r;r�r�r�r�r&r/r-r�r��s,���
�D��H��	��� r/r�c�$�eZdZd�Zd�Zd�Zd�Zy)�XMLRPCIntrospectionTestsc���t�}t|�tjdt	j
|�d��|_|jj�j|_g|_	yr�)
rUrrr�rr�r�r�r�r�)r+rs  r-r;zXMLRPCIntrospectionTests.setUp�sO������� ��"�"�1�f�k�k�&�&9�[�Q����F�F�N�N�$�)�)��	���r/c�r���fd�}�j�jd�}|j|�|S)Nc�N��|j��j|gd��y)N)r�r�rrrr�r�rqrr�r�rv�system.methodHelp�system.methodSignaturer)�sortr?)�methsr+s �r-�	cbMethodsz<XMLRPCIntrospectionTests.test_listMethods.<locals>.cbMethods�s"����J�J�L������
r/rvr)r+r�r�s`  r-r{z)XMLRPCIntrospectionTests.test_listMethods�s2���	�.
�J�J�L�#�#�$8�9��	�
�
�i� ��r/c���gd�}g}|D]R\}}|j�jd|�}|j|j|�|j	|��Ttj|d��S)N))rrk)rqr#)r�r�r�Tr�r��r+�inputOutputsr�r��expectedr�s      r-�test_methodHelpz(XMLRPCIntrospectionTests.test_methodHelpsp��
����*�	�N�D�(��
�
��'�'�(;�T�B�A�
�M�M�$�*�*�H�5��I�I�a�L�	��!�!�"�t�<�<r/c��ddgd�gd�gfdgd�gfg}g}|D]R\}}|j�jd|�}|j|j|�|j	|��Ttj|d�	�S)
N)rr#r�r`rbr�rhr�Tr�r�r�s      r-�test_methodSignaturez-XMLRPCIntrospectionTests.test_methodSignature#s����
�*�,J�K�L�
�0�1�2�
����*�	�N�D�(��
�
��'�'�(@�$�G�A�
�M�M�$�*�*�H�5��I�I�a�L�	��!�!�"�t�<�<r/N)r0r1r2r;r{r�r�r&r/r-r�r��s����8=�=r/r�c�"�eZdZdZd�Zd�Zd�Zy)�XMLRPCClientErrorHandlingTestsz3
    Test error handling on the xmlrpc client.
    c���tjdd�|_d|j_t	j
dt
j|j�d��|_y)Ns*This text is not a valid XML-RPC response.s
text/plainTrr�r�)	r�Datar:�isLeafrr�rr�r�rKs r-r;z$XMLRPCClientErrorHandlingTests.setUp7sK�����9�=�
��
� $��
�
���%�%�
�v�{�{�4�=�=�)�[�
��	r/c�6�|jj�Sr*)r�r�rKs r-r�z'XMLRPCClientErrorHandlingTests.tearDownAs���y�y�&�&�(�(r/c���tjtd|jj	�jfz��}|j|j
d�t�S)zj
        Test that calling the xmlrpc client on a static http server raises
        an exception.
        r�r^)rr�rr�r�r(r��
ValueError)r+r�s  r-�test_erroneousResponsez5XMLRPCClientErrorHandlingTests.test_erroneousResponseDsV��
����0�D�I�I�4E�4E�4G�4L�4L�3N�N�O�
���!�!�%�"2�"2�<�"@�*�M�Mr/N)r0r1r2rMr;r�r�r&r/r-r�r�2s���
�)�Nr/r�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�QueryFactoryParseResponseTestsz>
    Test the behaviour of L{QueryFactory.parseResponse}.
    c	��tddddddd��|_tjd�|_d|_t
jt��|_	y)Nr$Fr&)�path�hostr6r�r�r�r�)r#zinvalid xml)
rr�rr7�goodContents�badContentsrrJr�reasonrKs r-r;z$QueryFactoryParseResponseTests.setUpTsV��)��������
���&�O�O�E�2���(����o�o�n�&6�7��r/c���|jj}|j|jj|j�|jj|j�|S)z�
        We can safely call L{QueryFactory.clientConnectionLost} as a callback
        of L{QueryFactory.parseResponse}.
        )r��deferredr��clientConnectionLostr��
parseResponser�rts  r-� test_parseResponseCallbackSafetyz?QueryFactoryParseResponseTests.test_parseResponseCallbackSafetyhsT��

���&�&��	
�
�
�d�'�'�<�<�d�k�k�J����'�'��(9�(9�:��r/c���|jj}|j|jj|j�|jj|j�|S)z�
        We can safely call L{QueryFactory.clientConnectionLost} as an errback
        of L{QueryFactory.parseResponse}.
        )r�r��
addErrbackr�r�r�r�rts  r-�test_parseResponseErrbackSafetyz>QueryFactoryParseResponseTests.test_parseResponseErrbackSafetyusT��

���&�&��	
���T�&�&�;�;�T�[�[�I����'�'��(8�(8�9��r/c���|jj}|j|jj|j�|jjdd�|S)z}
        We can safely call L{QueryFactory.clientConnectionLost} as an errback
        of L{QueryFactory.badStatus}.
        �status�message)r�r�r�r�r��	badStatusrts  r-�test_badStatusErrbackSafetyz:QueryFactoryParseResponseTests.test_badStatusErrbackSafety�sP��

���&�&��	
���T�&�&�;�;�T�[�[�I����#�#�H�i�8��r/c��d}|jj}|jj|�|j|t�S)z�
        Some server can send a response without any data:
        L{QueryFactory.parseResponse} should catch the error and call the
        result errback.
        zM
<methodResponse>
 <params>
  <param>
  </param>
 </params>
</methodResponse>)r�r�r�r(�
IndexError)r+r8r�s   r-�test_parseResponseWithoutDataz<QueryFactoryParseResponseTests.test_parseResponseWithoutData�sC����
���&�&�����'�'��0��!�!�!�Z�0�0r/N)	r0r1r2rMr;r�r�r�r�r&r/r-r�r�Os ���8�(���1r/r�c��eZdZd�Zd�Zy)�XMLRPCWithRequestTestsc�"�t�|_yr*)rUr:rKs r-r;zXMLRPCWithRequestTests.setUp�s�����
r/c����td�}d|_ttjdd��|_�fd�}|j
�j||�}�jj|�|S)z�
        When an XML-RPC method is called and the implementation is
        decorated with L{withRequest}, the request object is passed as
        the first argument.
        z/RPC2r$)r�rc�n��tj|jd�}�j|d�y)Nr))zPOST fooN)rrBr@r?)�nr5�datar+s   �r-�validz6XMLRPCWithRequestTests.test_withRequest.<locals>.valid�s+����?�?�7�?�?�1�#5�6�D����T�#8�9r/)
rr6rrr7r8�notifyFinishr�r:�render_POST)r+r5r�r�s`   r-�test_withRequestz'XMLRPCWithRequestTests.test_withRequest�sf����w�'�����"�9�?�?�8�]�#K�L���	:�
� � �"�.�.�u�g�>���
�
�!�!�'�*��r/N)r0r1r2r;r�r&r/r-r�r��s���r/r�)FrMr��iorrrr�twisted.internetrr�twisted.internet.errorr�twisted.internet.testingr	r
�twisted.loggerrrr
r�twisted.pythonr�twisted.python.compatrr�twisted.python.reflectr�
twisted.trial�twisted.webrrrrr�twisted.web.test.test_webr�twisted.web.xmlrpcrrrrrrrf�ImportError�TestCaser!rLrOr�rSrUr�r�r�r�r�r�r�r�rhrlr}r�r�r�r�r�r�r�r&r/r-�<module>r�s���
�
� ��+�1�H���#�=�.�"�<�<�2�����&�'��G�-3�x�(�(�-3�`	�|�	�	�Z�	�\�6�\�~
�&�
�*
��
�B�T�B�$8��,�,�8�*
<�v�*�*�
<�#�V�0�0�#�A8�(�#�#�A8�H�;��4�x�'8�'8�4�n-�-�`�3�X�5F�5F��7�5�x�7H�7H�7�=�{�=�@>=�{�>=�BN�X�%6�%6�N�:O1�X�%6�%6�O1�d�X�.�.���s���G��s�6G�G"�!G"
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!