Skip to content

Commit

Permalink
Add description for test functions
Browse files Browse the repository at this point in the history
Signed-off-by: pem70 <[email protected]>
  • Loading branch information
pem70 committed May 28, 2024
1 parent 47e34f4 commit 046a4c7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/unit/test_zowe_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,14 @@ def test_perform_streamed_request(self, mock_send_request, mock_logger_error: mo

mock_logger_error.assert_not_called()
mock_logger_debug.assert_called()

#
# # This will fail because parameter also contains the arguments of perform_request
# mock_logger_debug.assert_called_with("Request method: GET")
#
# But this will pass because we are partially looking for the request method in the first argument
self.assertIn("Request method: GET", mock_logger_debug.call_args[0][0])

mock_send_request.assert_called_once()
self.assertTrue(mock_send_request.call_args[1]["stream"])


@mock.patch("logging.Logger.error")
def test_logger_unmatched_status_code(self, mock_logger_error: mock.MagicMock):
"""Test logger with unexpeceted status code"""
request_handler = RequestHandler(self.session_arguments)
try:
request_handler.perform_request("GET", {"url": "https://www.zowe.org"}, expected_code= [0], stream = True)
Expand All @@ -204,6 +198,7 @@ def test_logger_unmatched_status_code(self, mock_logger_error: mock.MagicMock):

@mock.patch("logging.Logger.error")
def test_logger_perform_request_invalid_method(self, mock_logger_error: mock.MagicMock):
"""Test logger with invalid request method"""
request_handler = RequestHandler(self.session_arguments)
try:
request_handler.perform_request("Invalid method", {"url": "https://www.zowe.org"}, stream = True)
Expand Down Expand Up @@ -482,7 +477,7 @@ def test_get_profilename_from_profiletype_invalid_profile_type(self, get_pass_fu
@mock.patch("zowe.secrets_for_zowe_sdk.keyring.get_password", side_effect=keyring_get_password)
def test_validate_schema_logger(self, get_pass_func, mock_logger_warning: mock.MagicMock):
"""
Test correct exceptions are being thrown when schema property is empty.
Test correct exceptions are being thrown when schema property is not set.
Schema property will be initialized to None.
"""
Expand Down Expand Up @@ -1074,7 +1069,8 @@ def test_validate_config_json_invalid(self):
class test_logger_setLoggerLevel(TestCase):

def test_logger_setLoggerLevel(self):
"""Test setLoggerLevel"""
test_logging = logger.Log()
test_value = logging.INFO
test_value = logging.DEBUG
test_logging.setLoggerLevel(test_value)
self.assertEqual(logging.root.level, test_value)

0 comments on commit 046a4c7

Please sign in to comment.