%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/test/__pycache__/test_syslog.cpython-312.pyc

�

Ϫ�f-��f�ddlmZddlmZ	ddlZeZddlmZGd�de�Z	y#e$rdZY�wxYw)�)�Failure)�TestCaseN)�syslogc�d�eZdZdZdZe�dZd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zy)�SyslogObserverTestszS
    Tests for L{SyslogObserver} which sends Twisted log events to the syslog.
    Nz(syslog is not supported on this platformc���|jtjd|j�|jtjd|j�tjd�|_y)N�openlogrr)�patchr�SyslogObserverr	�observer��selfs �A/usr/lib/python3/dist-packages/twisted/python/test/test_syslog.py�setUpzSyslogObserverTests.setUpsI���
�
�6�(�(�)�T�\�\�B��
�
�6�(�(�(�D�K�K�@��-�-�.C�D��
�c�&�|||f|_g|_y�N)�	logOpened�events)r�prefix�options�facilitys    rr	zSyslogObserverTests.openlogs�� �'�8�4�����rc�>�|jj||f�yr)r�append)rr�messages   rrzSyslogObserverTests.syslog#s�������G�W�-�.rc�z�|jjdddd��|j|jg�y)zm
        L{SyslogObserver.emit} ignores events with an empty value for the
        C{'message'} key.
        �F�-�r�isError�systemN)r�emit�assertEqualrr
s r�test_emitWithoutMessagez+SyslogObserverTests.test_emitWithoutMessage&s1��
	
�
�
���r�e�s�K�L�������b�)rc��|jjdddtjd��|j	|j
tjdfg�y)��
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the
        syslog priority, if that key is present in the event dictionary.
        �zhello, worldFr)rr r!�syslogPriority�[-] hello, worldN)rr"�	stdsyslog�	LOG_DEBUGr#rr
s r�test_emitCustomPriorityz+SyslogObserverTests.test_emitCustomPriority.sR��
	
�
�
���,� ��"+�"5�"5�	
�	
�	
������	�(;�(;�=O�'P�&Q�Rrc
���|jjdddttd��d��|j	|j
tjdfg�y)zd
        L{SyslogObserver.emit} uses C{LOG_ALERT} if the event represents an
        error.
        r'Tr�foo)rr r!�failurer)N)rr"r�	Exceptionr#rr*�	LOG_ALERTr
s r�test_emitErrorPriorityz*SyslogObserverTests.test_emitErrorPriority=sV��
	
�
�
���,���"�9�U�#3�4�	
�	
�	
������	�(;�(;�=O�'P�&Q�Rrc���|jjdddtjt	td��d��|j
|jtjdfg�y)z�
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} key if
        it is specified even if the event dictionary represents an error.
        r'Tr�bar)rr r!r(r/r)N)rr"r*�
LOG_NOTICErr0r#rr
s r�%test_emitCustomPriorityOverridesErrorz9SyslogObserverTests.test_emitCustomPriorityOverridesErrorLs_��
	
�
�
���,���"+�"6�"6�"�9�U�#3�4�
�	
�	
������	�(<�(<�>P�'Q�&R�Src���|jjdddtjd��|j	|j
tjtjzdfg�y)r&r'Fr)rr r!�syslogFacilityr)N)rr"r*�LOG_CRONr#r�LOG_INFOr
s r�test_emitCustomFacilityz+SyslogObserverTests.test_emitCustomFacility\s`��
	
�
�
���,� ��"+�"4�"4�	
�	
�	
����K�K�9�-�-�	�0B�0B�B�DV�W�X�	
rc��|jjdddd��|j|jtj
dfg�y)zt
        L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix
        the logged message.
        r'F�nonDefaultSystemrz[nonDefaultSystem] hello, worldN�rr"r#rr*r:r
s r�test_emitCustomSystemz)SyslogObserverTests.test_emitCustomSystemmsL��
	
�
�
���,� �,�
�	
�	
����K�K�9�-�-�/P�Q�R�	
rc��|jjdddd��|j|jtj
dfg�y)z�
        L{SyslogObserver.emit} logs the value of the C{'message'} key of the
        event dictionary it is passed to the syslog.
        r'Frrr)Nr>r
s r�test_emitMessagez$SyslogObserverTests.test_emitMessage}sE��
	
�
�
���)�e�s�K�	
�	
������	�(:�(:�<N�'O�&P�Qrc��|jjdddd��|j|jtj
dftj
dfg�y)zW
        Each line of a multiline message is emitted separately to the syslog.
        )zhello,
worldFrr�
[-] hello,�
[-] 	worldNr>r
s r�test_emitMultilineMessagez-SyslogObserverTests.test_emitMultilineMessage�sU��	
�
�
���*�u��L�	
�	
����K�K�� � �,�
/�)�2D�2D�m�1T�U�	
rc��|jjdddd��|j|jtj
dftj
dfg�y)zw
        Trailing empty lines of a multiline message are omitted from the
        messages sent to the syslog.
        )zhello,
world

FrrrCrDNr>r
s r�!test_emitStripsTrailingEmptyLinesz5SyslogObserverTests.test_emitStripsTrailingEmptyLines�sU��
	
�
�
���.�5�C�P�	
�	
����K�K�� � �,�
/�)�2D�2D�m�1T�U�	
r)�__name__�
__module__�__qualname__�__doc__rr*�skiprr	rr$r,r2r6r;r?rArErGrrrrrsZ����F���9��E�
�/�*�
S�
S�T� 
�"
� R�

�
rr)
�twisted.python.failurer�twisted.trial.unittestrr�
_stdsyslogr*�twisted.python�ImportErrorrrrr�<module>rRsC��+�+�&���I�%�N
�(�N
�����I��s�&�0�0

Zerion Mini Shell 1.0