CasperSecurity

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

o

�b-�@s`ddlmZddlmZzddlZWneydZYn	weZddlmZGdd�de�Z	dS)�)�Failure)�TestCaseN)�syslogc@s�eZdZdZdZedurdZdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�SyslogObserverTestszS
    Tests for L{SyslogObserver} which sends Twisted log events to the syslog.
    Nz(syslog is not supported on this platformcCs4|�tjd|j�|�tjd|j�t�d�|_dS)N�openlogrr)�patchr�SyslogObserverr�observer��self�r�A/usr/lib/python3/dist-packages/twisted/python/test/test_syslog.py�setUpszSyslogObserverTests.setUpcCs|||f|_g|_dS�N)�	logOpened�events)r�prefix�options�facilityrrr
rs
zSyslogObserverTests.openlogcCs|j�||f�dSr)r�append)rr�messagerrr
r#szSyslogObserverTests.syslogcCs&|j�dddd��|�|jg�dS)zm
        L{SyslogObserver.emit} ignores events with an empty value for the
        C{'message'} key.
        rF�-�r�isError�systemN)r	�emit�assertEqualrr
rrr
�test_emitWithoutMessage&sz+SyslogObserverTests.test_emitWithoutMessagecCs2|j�dddtjd��|�|jtjdfg�dS)��
        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)rrr�syslogPriority�[-] hello, worldN)r	r�	stdsyslog�	LOG_DEBUGrrr
rrr
�test_emitCustomPriority.s��z+SyslogObserverTests.test_emitCustomPrioritycCs8|j�dddttd��d��|�|jtjdfg�dS)zd
        L{SyslogObserver.emit} uses C{LOG_ALERT} if the event represents an
        error.
        rTr�foo)rrr�failurer!N)r	rr�	Exceptionrrr"�	LOG_ALERTr
rrr
�test_emitErrorPriority=s
��z*SyslogObserverTests.test_emitErrorPriorityc	Cs<|j�dddtjttd��d��|�|jtjdfg�dS)z�
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} key if
        it is specified even if the event dictionary represents an error.
        rTr�bar)rrrr r&r!N)r	rr"�
LOG_NOTICErr'rrr
rrr
�%test_emitCustomPriorityOverridesErrorLs
��	z9SyslogObserverTests.test_emitCustomPriorityOverridesErrorcCs8|j�dddtjd��|�|jtjtjBdfg�dS)rrFr)rrr�syslogFacilityr!N)r	rr"�LOG_CRONrr�LOG_INFOr
rrr
�test_emitCustomFacility\s���z+SyslogObserverTests.test_emitCustomFacilitycC�.|j�dddd��|�|jtjdfg�dS)zt
        L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix
        the logged message.
        rF�nonDefaultSystemrz[nonDefaultSystem] hello, worldN�r	rrrr"r/r
rrr
�test_emitCustomSystemms���z)SyslogObserverTests.test_emitCustomSystemcCr1)z�
        L{SyslogObserver.emit} logs the value of the C{'message'} key of the
        event dictionary it is passed to the syslog.
        rFrrr!Nr3r
rrr
�test_emitMessage}s
�z$SyslogObserverTests.test_emitMessagecC�6|j�dddd��|�|jtjdftjdfg�dS)zW
        Each line of a multiline message is emitted separately to the syslog.
        )zhello,
worldFrr�
[-] hello,�
[-] 	worldNr3r
rrr
�test_emitMultilineMessage�s
��z-SyslogObserverTests.test_emitMultilineMessagecCr6)zw
        Trailing empty lines of a multiline message are omitted from the
        messages sent to the syslog.
        )zhello,
world

Frrr7r8Nr3r
rrr
�!test_emitStripsTrailingEmptyLines�s
��z5SyslogObserverTests.test_emitStripsTrailingEmptyLines)�__name__�
__module__�__qualname__�__doc__rr"�skiprrrrr$r)r,r0r4r5r9r:rrrr
rs"
r)
�twisted.python.failurer�twisted.trial.unittestrr�
_stdsyslog�ImportErrorr"�twisted.pythonrrrrr
�<module>s�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY