U ™-_¸ ã@s.ddlTddlZddlZGdd„dejƒZdS)é)Ú*Nc@sDeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dS)Ú TestLogHelpercCs–t d¡}t ¡}| |¡g}tttjjƒƒD]}| tjj|j ¡q0t ddddg}tttjjƒƒD]}| tjj|j ¡ql|  ||¡dS)NÚ1ÚDEBUGÚCRITICAL©ÚlevelÚ formatter_clsZ boto_level) ÚloggingÚ getLoggerÚ StreamHandlerÚ addHandlerÚrangeÚlenÚrootÚhandlersÚappendÚ formatterÚsetupÚ assertEqual)ÚselfÚloggerÚhandlerZorig_formattersÚcZnew_formatters©rú9/tmp/pip-unpacked-wheel-7s1ms2ou/tests/test_log_helper.pyÚtest_logging_no_formattings  z(TestLogHelper.test_logging_no_formattingcCsPt d¡}t ¡}| |¡tdddddD]}t |¡}| |jd¡q.dS)NÚ2rrr©ZbotoZboto3ZbotocoreÚurllib3é2)r r r r rrr©rrrÚtZb_loggerrrrÚtest_logging_boto_explicits   z(TestLogHelper.test_logging_boto_explicitcCsNt d¡}t ¡}| |¡tdtddtjjD]}| tt |j ƒ¡q2dS)NÚ3rÚ ContainerInit©rr Ú RequestType) r r r r rÚ JsonFormatterrrrÚtyper)rrrrrrÚtest_logging_jsons    zTestLogHelper.test_logging_jsoncCsPt d¡}t ¡}| |¡tdtdddD]}t |¡}| |jd¡q.dS)NÚ4rr%r&ré )r r r r rr(rrr!rrrÚtest_logging_boto_implicit&s   z(TestLogHelper.test_logging_boto_implicitc Csx| ¡H}t ¡}t ¡}| |¡tdtdd| d¡t  |j d¡}W5QRX|  dddd d gt |  ¡ƒ¡dS) Nrr%r&ÚtestrÚ timestamprÚlocationr'Úmessage)Ú assertLogsr r r r rr(ÚinfoÚjsonÚloadsÚoutputrÚlistÚkeys©rÚctxrrÚlogsrrrÚtest_logging_json_keys/s   z$TestLogHelper.test_logging_json_keysc Csj| ¡H}t ¡}t ¡}| |¡tdtdd| d¡t  |j d¡}W5QRX|  i|d¡dS)Nrr%r&z{}rr1) r2r r r r rr(r3r4r5r6rr9rrrÚtest_logging_json_parse_message9s   z-TestLogHelper.test_logging_json_parse_messagec Csž| ¡|}t ¡}t ¡}| |¡tdtddz ddWn0tk rn}z|jdddW5d}~XYnXt   |j d ¡}W5QRX|  d |  ¡¡dS) Nrr%r&ér"z[]T)Úexc_inforÚ exception)r2r r r r rr(Ú Exceptionr3r4r5r6ZassertInr8)rr:rrÚer;rrrÚtest_logging_json_exceptionCs    z)TestLogHelper.test_logging_json_exceptionN) Ú__name__Ú __module__Ú __qualname__rr#r*r-r<r=rCrrrrrs     r)Zcrhelper.log_helperZunittestr ZTestCaserrrrrÚs