From 0cb6abeb02d4badb68d40bdc650bd66c7fbda6be Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 14 Dec 2021 17:05:01 +0100 Subject: [PATCH] Adding test/test_00_mailaddress.py --- test/general.py | 2 +- test/test_00_mailaddress.py | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100755 test/test_00_mailaddress.py diff --git a/test/general.py b/test/general.py index d148ce5..d454808 100644 --- a/test/general.py +++ b/test/general.py @@ -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 index 0000000..2c2dd2d --- /dev/null +++ b/test/test_00_mailaddress.py @@ -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 -- 2.39.5