]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Adding test/test_00_mailaddress.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 14 Dec 2021 16:05:01 +0000 (17:05 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 14 Dec 2021 16:05:01 +0000 (17:05 +0100)
test/general.py
test/test_00_mailaddress.py [new file with mode: 0755]

index d148ce5314a330573c6364fea1d28b3d28c22d6e..d454808568144dd6a98d230dbf9afc462c538d7f 100644 (file)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 """
 @author: Frank Brehm
-@contact: frank@brehm-online.com
+@contact: frank.brehm@pixelpark.com
 @copyright: © 2021 Frank Brehm, Digitas Pixelpark GmbH Berlin
 @license: LGPL3
 @summary: general used functions an objects used for unit tests on
diff --git a/test/test_00_mailaddress.py b/test/test_00_mailaddress.py
new file mode 100755 (executable)
index 0000000..2c2dd2d
--- /dev/null
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+'''
+@author: Frank Brehm
+@contact: frank.brehm@pixelpark.com
+@copyright: © 2021 Frank Brehm, Digitas Pixelpark GmbH Berlin
+@license: LGPL3
+@summary: test script (and module) for unit tests on mailaddress class and objects
+'''
+
+import os
+import sys
+import logging
+
+try:
+    import unittest2 as unittest
+except ImportError:
+    import unittest
+
+libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib'))
+sys.path.insert(0, libdir)
+
+from general import PpAdminToolsTestcase, get_arg_verbose, init_root_logger
+
+LOG = logging.getLogger('test_mailaddress')
+
+
+# =============================================================================
+class TestMailaddress(PpAdminToolsTestcase):
+
+    # -------------------------------------------------------------------------
+    def setUp(self):
+        pass
+
+    # -------------------------------------------------------------------------
+    def test_import(self):
+
+        LOG.info("Testing import of pp_admintools.mailaddress ...")
+        import pp_admintools.mailaddress
+        LOG.debug("Version of pp_admintools.mailaddress: {!r}".format(
+            pp_admintools.mailaddress.__version__))
+
+    # -------------------------------------------------------------------------
+    def test_object(self):
+
+        LOG.info("Testing init of a simple mailaddress object.")
+
+        from pp_admintools.mailaddress import MailAddress
+
+        obj = MailAddress('frank.brehm@pixelpark.com')
+        LOG.debug("MailAddress %%r: %r", obj)
+        LOG.debug("MailAddress %%s: %s", str(obj))
+
+
+# =============================================================================
+if __name__ == '__main__':
+
+    verbose = get_arg_verbose()
+    if verbose is None:
+        verbose = 0
+    init_root_logger(verbose)
+
+    LOG.info("Starting tests ...")
+
+    suite = unittest.TestSuite()
+
+    suite.addTest(TestMailaddress('test_import', verbose))
+    suite.addTest(TestMailaddress('test_object', verbose))
+
+    runner = unittest.TextTestRunner(verbosity=verbose)
+
+    result = runner.run(suite)
+
+
+# =============================================================================
+
+# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4