Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/python/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyc

ó
[³XMc@stddlmZddlmZyddlZWnek
rIdZnXddlmZdefd„ƒYZ	dS(iÿÿÿÿ(tTestCase(tFailureN(tsyslogtSyslogObserverTestscBs•eZdZdZedkr'dZnd„Zd„Zd„Z	d„Z
d„Zd„Zd„Z
d	„Zd
„Zd„Zd„Zd
„ZRS(sS
    Tests for L{SyslogObserver} which sends Twisted log events to the syslog.
    s(syslog is not supported on this platformcCsH|jtjd|jƒ|jtjd|jƒtjdƒ|_dS(NtopenlogRR(tpatchRtSyslogObserverRtobserver(tself((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pytsetUpscCs|||f|_g|_dS(N(t	logOpenedtevents(Rtprefixtoptionstfacility((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyRscCs|jj||fƒdS(N(Rtappend(RR
tmessage((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyR$scCs<|jjidd6td6dd6ƒ|j|jgƒdS(sm
        L{SyslogObserver.emit} ignores events with an empty value for the
        C{'message'} key.
        RtisErrort-tsystemN((RtemittFalsetassertEqualR(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitWithoutMessage(s%cCsR|jjid	d6td6dd6tjd6ƒ|j|jtjdfgƒdS(
s¢
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the
        syslog priority, if that key is present in the event dictionary.
        shello, worldRRRRtsyslogPrioritys[-] hello, worldN(shello, world(RRRt	stdsyslogt	LOG_DEBUGRR(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitCustomPriority1scCs[|jjid
d6td6dd6ttdƒƒd6ƒ|j|jtjdfgƒd	S(sd
        L{SyslogObserver.emit} uses C{LOG_ALERT} if the event represents an
        error.
        shello, worldRRRRtfootfailures[-] hello, worldN(shello, world(	RRtTrueRt	ExceptionRRRt	LOG_ALERT(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitErrorPriority>scCse|jjidd6td6dd6tjd6ttdƒƒd6ƒ|j|jtjd	fgƒd
S(s£
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} key if
        it is specified even if the event dictionary represents an error.
        shello, worldRRRRRtbarRs[-] hello, worldN(shello, world(	RRRRt
LOG_NOTICERRRR(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyt%test_emitCustomPriorityOverridesErrorKs
cCsY|jjid	d6td6dd6tjd6ƒ|j|jtjtjBdfgƒdS(
s¢
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the
        syslog priority, if that key is present in the event dictionary.
        shello, worldRRRRtsyslogFacilitys[-] hello, worldN(shello, world(RRRRtLOG_CRONRRtLOG_INFO(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitCustomFacilityYscCsH|jjidd6td6dd6ƒ|j|jtjdfgƒdS(	st
        L{SyslogObserver.emit} uses the value of the C{'system'} key to prefix
        the logged message.
        shello, worldRRtnonDefaultSystemRs[nonDefaultSystem] hello, worldN(shello, world(RRRRRRR'(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitCustomSystemfs
cCsH|jjidd6td6dd6ƒ|j|jtjdfgƒdS(	s‹
        L{SyslogObserver.emit} logs the value of the C{'message'} key of the
        event dictionary it is passed to the syslog.
        shello, worldRRRRs[-] hello, worldN(shello, world(RRRRRRR'(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitMessagerscCsT|jjid	d6td6dd6ƒ|j|jtjdftjdfgƒdS(
sW
        Each line of a multiline message is emitted separately to the syslog.
        shello,
worldRRRRs
[-] hello,s
[-] 	worldN(shello,
world(RRRRRRR'(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyttest_emitMultilineMessagescCsT|jjid	d6td6dd6ƒ|j|jtjdftjdfgƒdS(
sw
        Trailing empty lines of a multiline message are omitted from the
        messages sent to the syslog.
        shello,
world

RRRRs
[-] hello,s
[-] 	worldN(shello,
world

(RRRRRRR'(R((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyt!test_emitStripsTrailingEmptyLinesŒsN(t__name__t
__module__t__doc__tNoneRRtskipR	RRRRR!R$R(R*R+R,R-(((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyRs 							
	
		
		
	
(
ttwisted.trial.unittestRttwisted.python.failureRRRtImportErrorR1ttwisted.pythonR(((sC/usr/lib/python2.7/dist-packages/twisted/python/test/test_syslog.pyt<module>s