From 536696b004b72acc73512cf83033649faf4416fb Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Tue, 15 Oct 2013 06:56:55 -0700 Subject: [PATCH] munkicommon_unicode_test.py: Break tests up into smaller groups; redefine munkicommon.log so tests don't write garbage to the logs --- .../munkilib/munkicommon_unicode_test.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/code/client/munkilib/munkicommon_unicode_test.py b/tests/code/client/munkilib/munkicommon_unicode_test.py index 6ef82aa8..e20558bc 100755 --- a/tests/code/client/munkilib/munkicommon_unicode_test.py +++ b/tests/code/client/munkilib/munkicommon_unicode_test.py @@ -32,9 +32,16 @@ MSG_STR = 'Günther\'s favorite thing is %s' ARG_UNI = u'Günther' ARG_STR = 'Günther' +def log(msg, logname=''): + """Redefine munkicommon's logging function so our tests don't write + a bunch of garbage to Munki's logs""" + pass +munkicommon.log = log -class TestUnicodeOutput(unittest.TestCase): - """Test munkicommon display_* functions with text that may or may not be proper Unicode.""" + +class TestDisplayInfoUnicodeOutput(unittest.TestCase): + """Test munkicommon display_info with text that may or may not be proper + Unicode.""" def test_display_info_with_unicode_msg(self): munkicommon.display_info(MSG_UNI) @@ -54,6 +61,11 @@ class TestUnicodeOutput(unittest.TestCase): def test_display_info_with_str_msg_str_arg(self): munkicommon.display_info(MSG_STR, ARG_STR) + +class TestDisplayWarningUnicodeOutput(unittest.TestCase): + """Test munkicommon display_warning with text that may or may not be proper + Unicode.""" + def test_display_warning_with_unicode_msg(self): munkicommon.display_warning(MSG_UNI) @@ -72,6 +84,11 @@ class TestUnicodeOutput(unittest.TestCase): def test_display_warning_with_str_msg_str_arg(self): munkicommon.display_warning(MSG_STR, ARG_STR) + +class TestDisplayErrorUnicodeOutput(unittest.TestCase): + """Test munkicommon display_error with text that may or may not be proper + Unicode.""" + def test_display_error_with_unicode_msg(self): munkicommon.display_error(MSG_UNI) @@ -90,6 +107,7 @@ class TestUnicodeOutput(unittest.TestCase): def test_display_error_with_str_msg_str_arg(self): munkicommon.display_error(MSG_STR, ARG_STR) + def main(): unittest.main(buffer=True)