def __init__(self, err_msg): """Constructor method to add message to missing mandatory argument""" utils.log('ERROR', "Missing mandatory argument, {}".format(err_msg)) super(MissingMandatoryArgument, self).__init__("Missing mandatory argument, {}".format(err_msg))
def __init__(self, err_msg): """Constructor method to add raise exception""" utils.log('ERROR', err_msg) super(MyException, self).__init__(err_msg)
def test_utils_log_level_none(self): self.assertEqual(utils.log('Message'), None)
def test_utils_log(self): self.assertEqual(utils.log('INFO', 'Message'), None)
def test_utils_log_exception(self): with self.assertRaises(Exception) as context: utils.log() self.assertTrue( "Issued 'log' without arguments. t.log() Requires min 1 argument" in str(context.exception))