From 04c028da264d17a21b74f1d976cbb98dbdde973b Mon Sep 17 00:00:00 2001 From: Elijah Swift Date: Mon, 4 Dec 2023 13:54:04 -0500 Subject: [PATCH] Naming and Docstring Updates Signed-off-by: Elijah Swift --- pyracf/common/downstream_fatal_error.py | 4 +-- tests/common/test_common_constants.py | 6 ++--- ...check_script.py => test_setup_precheck.py} | 26 +++++++++---------- tests/test_runner.py | 4 +-- 4 files changed, 20 insertions(+), 20 deletions(-) rename tests/common/{test_install_precheck_script.py => test_setup_precheck.py} (85%) diff --git a/pyracf/common/downstream_fatal_error.py b/pyracf/common/downstream_fatal_error.py index c3882837..33c5b4ca 100644 --- a/pyracf/common/downstream_fatal_error.py +++ b/pyracf/common/downstream_fatal_error.py @@ -1,10 +1,10 @@ -"""Exception to use when no data is returned by IRRSMO00.""" +"""Exception to use when IRRSMO00 returns with an error.""" from typing import Union class DownstreamFatalError(Exception): """ - Raised when no xml string is returned by IRRSMO00. + Raised IRRSMO00 returns with a return code of 8, indicating an error occured prior to request. """ def __init__( diff --git a/tests/common/test_common_constants.py b/tests/common/test_common_constants.py index c3518a29..8a36a443 100644 --- a/tests/common/test_common_constants.py +++ b/tests/common/test_common_constants.py @@ -29,20 +29,20 @@ def get_sample(sample_file: str, function_group: str) -> Union[str, bytes]: "add_resource_result_precheck_uacc_none_success.json", "resource" ) -TEST_INSTALL_PRECHECK_VALIDATED_ACCESS_TEXT = ( +TEST_SETUP_PRECHECK_VALIDATED_ACCESS_TEXT = ( "IRR.IRRSMO00.PRECHECK is already defined, and you already have alter access!" + "\nYou are ready to start using pyRACF!" + "\nPlease ensure other users of pyRACF also have at least read access." + "\nReview our documentation at https://ambitus.github.io/pyracf/ as well!\n" ) -TEST_INSTALL_PRECHECK_FOUND_NO_ACCESS_TEXT = ( +TEST_SETUP_PRECHECK_FOUND_NO_ACCESS_TEXT = ( "IRR.IRRSMO00.PRECHECK is already defined, but you have no access." + "\nContact your security administrator for READ access before using pyRACF." + "\nReview our documentation at https://ambitus.github.io/pyracf/ as well!\n" ) -TEST_INSTALL_PRECHECK_DEFINED_PROFILE_TEXT = ( +TEST_SETUP_PRECHECK_DEFINED_PROFILE_TEXT = ( "IRR.IRRSMO00.PRECHECK is now defined with a `Universal Access` of None." + "\nContact your security administrator for READ access before using pyRACF." + "\nOther users of pyRACF will also need to have at least read access." diff --git a/tests/common/test_install_precheck_script.py b/tests/common/test_setup_precheck.py similarity index 85% rename from tests/common/test_install_precheck_script.py rename to tests/common/test_setup_precheck.py index 53426057..7af95173 100644 --- a/tests/common/test_install_precheck_script.py +++ b/tests/common/test_setup_precheck.py @@ -17,12 +17,12 @@ @patch("pyracf.common.irrsmo00.IRRSMO00.call_racf") -class TestInstallPrecheckScript(unittest.TestCase): +class TestSetupPrecheck(unittest.TestCase): maxDiff = None IRRSMO00.__init__ = Mock(return_value=None) ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") - def test_install_precheck_works_when_no_setup_done( + def test_setup_precheck_works_when_no_setup_done( self, call_racf_mock: Mock, ): @@ -36,14 +36,14 @@ def test_install_precheck_works_when_no_setup_done( result = setup_precheck() precheck_log = self.ansi_escape.sub("", stdout.getvalue()) self.assertEqual( - precheck_log, TestCommonConstants.TEST_INSTALL_PRECHECK_DEFINED_PROFILE_TEXT + precheck_log, TestCommonConstants.TEST_SETUP_PRECHECK_DEFINED_PROFILE_TEXT ) self.assertEqual( result, TestCommonConstants.TEST_ADD_RESOURCE_PRECHECK_UACC_NONE_SUCCESS_DICTIONARY, ) - def test_install_precheck_works_when_alter_access_exists( + def test_setup_precheck_works_when_alter_access_exists( self, call_racf_mock: Mock, ): @@ -56,11 +56,11 @@ def test_install_precheck_works_when_alter_access_exists( precheck_log = self.ansi_escape.sub("", stdout.getvalue()) self.assertEqual( precheck_log, - TestCommonConstants.TEST_INSTALL_PRECHECK_VALIDATED_ACCESS_TEXT, + TestCommonConstants.TEST_SETUP_PRECHECK_VALIDATED_ACCESS_TEXT, ) self.assertEqual(result, True) - def test_install_precheck_works_when_control_access_exists( + def test_setup_precheck_works_when_control_access_exists( self, call_racf_mock: Mock, ): @@ -73,7 +73,7 @@ def test_install_precheck_works_when_control_access_exists( ) call_racf_mock.return_value = extract_with_control_access validated_control_access = ( - TestCommonConstants.TEST_INSTALL_PRECHECK_VALIDATED_ACCESS_TEXT + TestCommonConstants.TEST_SETUP_PRECHECK_VALIDATED_ACCESS_TEXT ) validated_control_access = validated_control_access.replace( "you already have alter access!", "you already have control access!" @@ -85,7 +85,7 @@ def test_install_precheck_works_when_control_access_exists( self.assertEqual(precheck_log, validated_control_access) self.assertEqual(result, True) - def test_install_precheck_works_when_read_access_exists( + def test_setup_precheck_works_when_read_access_exists( self, call_racf_mock: Mock, ): @@ -98,7 +98,7 @@ def test_install_precheck_works_when_read_access_exists( ) call_racf_mock.return_value = extract_with_read_access validated_read_access = ( - TestCommonConstants.TEST_INSTALL_PRECHECK_VALIDATED_ACCESS_TEXT + TestCommonConstants.TEST_SETUP_PRECHECK_VALIDATED_ACCESS_TEXT ) validated_read_access = validated_read_access.replace( "you already have alter access!", "you already have read access!" @@ -110,7 +110,7 @@ def test_install_precheck_works_when_read_access_exists( self.assertEqual(precheck_log, validated_read_access) self.assertEqual(result, True) - def test_install_precheck_works_when_update_access_exists( + def test_setup_precheck_works_when_update_access_exists( self, call_racf_mock: Mock, ): @@ -123,7 +123,7 @@ def test_install_precheck_works_when_update_access_exists( ) call_racf_mock.return_value = extract_with_update_access validated_update_access = ( - TestCommonConstants.TEST_INSTALL_PRECHECK_VALIDATED_ACCESS_TEXT + TestCommonConstants.TEST_SETUP_PRECHECK_VALIDATED_ACCESS_TEXT ) validated_update_access = validated_update_access.replace( "you already have alter access!", "you already have update access!" @@ -135,7 +135,7 @@ def test_install_precheck_works_when_update_access_exists( self.assertEqual(precheck_log, validated_update_access) self.assertEqual(result, True) - def test_install_precheck_works_when_none_access_exists( + def test_setup_precheck_works_when_none_access_exists( self, call_racf_mock: Mock, ): @@ -152,6 +152,6 @@ def test_install_precheck_works_when_none_access_exists( result = setup_precheck() precheck_log = self.ansi_escape.sub("", stdout.getvalue()) self.assertEqual( - precheck_log, TestCommonConstants.TEST_INSTALL_PRECHECK_FOUND_NO_ACCESS_TEXT + precheck_log, TestCommonConstants.TEST_SETUP_PRECHECK_FOUND_NO_ACCESS_TEXT ) self.assertEqual(result, False) diff --git a/tests/test_runner.py b/tests/test_runner.py index 946b33b0..11daa833 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -11,10 +11,10 @@ from tests.access.test_access_request_builder import TestAccessRequestBuilder from tests.access.test_access_result_parser import TestAccessResultParser from tests.common.test_customize_segment_traits import TestCustomizeSegmentTraits -from tests.common.test_install_precheck_script import TestInstallPrecheckScript from tests.common.test_logger import TestLogger from tests.common.test_run_as_userid import TestRunAsUserId from tests.common.test_security_request_error import TestDownstreamFatalError +from tests.common.test_setup_precheck import TestSetupPrecheck from tests.connection.test_connection_debug_logging import TestConnectionDebugLogging from tests.connection.test_connection_request_builder import ( TestConnectionRequestBuilder, @@ -67,7 +67,7 @@ def __test_suite() -> unittest.TestSuite: TestAccessRequestBuilder, TestAccessDebugLogging, TestCustomizeSegmentTraits, - TestInstallPrecheckScript, + TestSetupPrecheck, TestLogger, TestDownstreamFatalError, TestRunAsUserId,