Skip to content

Add comments to enable debug logging tests #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tests/unittests/test_enable_debug_logging_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@


class TestDebugLoggingEnabledFunctions(testutils.WebHostTestCase):
"""
Tests for cx debug logging enabled case.
"""
@classmethod
def setUpClass(cls):
os_environ = os.environ.copy()
Expand All @@ -40,6 +43,10 @@ def get_script_dir(cls):
return testutils.UNIT_TESTS_FOLDER / 'log_filtering_functions'

def test_debug_logging_enabled(self):
"""
Verify when cx debug logging is enabled, cx function debug logs
are recorded in host logs.
"""
r = self.webhost.request('GET', 'debug_logging')
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'OK-debug')
Expand All @@ -52,6 +59,9 @@ def check_log_debug_logging_enabled(self, host_out: typing.List[str]):


class TestDebugLoggingDisabledFunctions(testutils.WebHostTestCase):
"""
Tests for cx debug logging disabled case.
"""
@classmethod
def setUpClass(cls):
os_environ = os.environ.copy()
Expand All @@ -70,6 +80,10 @@ def get_script_dir(cls):
return testutils.UNIT_TESTS_FOLDER / 'log_filtering_functions'

def test_debug_logging_disabled(self):
"""
Verify when cx debug logging is disabled, cx function debug logs
are not written to host logs.
"""
r = self.webhost.request('GET', 'debug_logging')
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'OK-debug')
Expand All @@ -81,7 +95,11 @@ def check_log_debug_logging_disabled(self, host_out: typing.List[str]):
self.assertNotIn('logging debug', host_out)


class TestLogFilteringFunctions(testutils.WebHostTestCase):
class TestDebugLogEnabledHostFilteringFunctions(testutils.WebHostTestCase):
"""
Tests for enable debug logging flag enabled and host log level is
Information case.
"""
@classmethod
def setUpClass(cls):
host_json = TESTS_ROOT / cls.get_script_dir() / 'host.json'
Expand All @@ -108,6 +126,10 @@ def get_script_dir(cls):
return testutils.UNIT_TESTS_FOLDER / 'log_filtering_functions'

def test_debug_logging_filtered(self):
"""
Verify when cx debug logging is enabled and host logging level
is Information, cx function debug logs are not written to host logs.
"""
r = self.webhost.request('GET', 'debug_logging')
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, 'OK-debug')
Expand Down