Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2016-03-18 23:03:37 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2019-07-05 13:41:15 +0300
commitde8988118911ddbbd2d2e8488e83ed0d64e4c031 (patch)
tree4b9573ae9a32dffb3be8e958bd800e63276c49e6
parent356b1abeebad05dd0f8597bf12169f46053bc2da (diff)
Add a manual test script for sending log mail
-rwxr-xr-xtest/mail-test22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/mail-test b/test/mail-test
new file mode 100755
index 0000000..383f66e
--- /dev/null
+++ b/test/mail-test
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+import logging
+import os
+import time
+
+from calm.calm import mail_logs
+
+toaddrs = [os.environ.get('EMAIL', 'debug')]
+
+with mail_logs(True, toaddrs=toaddrs, subject='buffering_smtp_handler test (unicode)', thresholdLevel=logging.WARNING) as email:
+ logging.warning("this is a test")
+ logging.warning("unicode content: à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ù ú û ü")
+ logging.info("this should not appear in the sent mail")
+ logging.error("too many €")
+
+time.sleep(10)
+
+with mail_logs(True, toaddrs=toaddrs, subject='buffering_smtp_handler test (ascii)', thresholdLevel=logging.WARNING) as email:
+ logging.warning("this is a test")
+ logging.info("this should not appear in the sent mail")
+ logging.warning("no unicode content, should be ascii encoded")