From c445782985d299b5a55a90e3eb1bbfbbcc46173c Mon Sep 17 00:00:00 2001 From: adrian-wojcik Date: Wed, 10 Apr 2024 10:06:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20mug=20related=20to=20logge?= =?UTF-8?q?r.warning=20and=20tests=20in=20sap=5Frfc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/integration/tasks/test_sap_rfc_to_df.py | 2 +- tests/integration/test_sap_rfc.py | 12 ++++++------ viadot/sources/sap_rfc.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/integration/tasks/test_sap_rfc_to_df.py b/tests/integration/tasks/test_sap_rfc_to_df.py index 7007a978c..57e3451cb 100644 --- a/tests/integration/tasks/test_sap_rfc_to_df.py +++ b/tests/integration/tasks/test_sap_rfc_to_df.py @@ -22,7 +22,7 @@ def test_sap_rfc_to_df_wrong_sap_credential_key_bbp(caplog): ) with pytest.raises( CredentialError, - match="Sap_credentials_key: SAP_test is not stored neither in KeyVault or Local Config!", + match="sap_credentials_key: SAP_test is not stored neither in KeyVault or local config!", ): task.run( sap_credentials_key="SAP_test", diff --git a/tests/integration/test_sap_rfc.py b/tests/integration/test_sap_rfc.py index 2667d4d81..34d5106ed 100644 --- a/tests/integration/test_sap_rfc.py +++ b/tests/integration/test_sap_rfc.py @@ -195,7 +195,7 @@ def test___build_pandas_filter_query_v2(): def test_default_credentials_warning_SAPRFC(caplog): _ = SAPRFC() assert ( - f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in sap_credentials parameter" + f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in env parameter" in caplog.text ) @@ -203,7 +203,7 @@ def test_default_credentials_warning_SAPRFC(caplog): def test_default_credentials_warning_SAPRFCV2(caplog): _ = SAPRFCV2() assert ( - f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in sap_credentials parameter" + f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in env parameter" in caplog.text ) @@ -222,7 +222,7 @@ def test_credentials_dictionary_wrong_key_warning_SAPRFC(caplog): in caplog.text ) assert ( - f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in sap_credentials parameter" + f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in env parameter" in caplog.text ) @@ -241,7 +241,7 @@ def test_credentials_dictionary_wrong_key_warning_SAPRFCV2(caplog): in caplog.text ) assert ( - f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in sap_credentials parameter" + f"Your credentials will use DEV environment from local config. If you would like to use different one - please specified it in env parameter" in caplog.text ) @@ -249,7 +249,7 @@ def test_credentials_dictionary_wrong_key_warning_SAPRFCV2(caplog): def test_sap_credentials_key_wrong_value_error_SAPRFC(caplog): with pytest.raises( CredentialError, - match="Sap_credentials_key: SAP_test is not stored neither in KeyVault or Local Config!", + match="sap_credentials_key: SAP_test is not stored neither in KeyVault or local config!", ): with caplog.at_level(logging.ERROR): _ = SAPRFC(sap_credentials_key="SAP_test") @@ -258,7 +258,7 @@ def test_sap_credentials_key_wrong_value_error_SAPRFC(caplog): def test_sap_credentials_key_wrong_value_error_SAPRFCV2(caplog): with pytest.raises( CredentialError, - match="Sap_credentials_key: SAP_test is not stored neither in KeyVault or Local Config!", + match="sap_credentials_key: SAP_test is not stored neither in KeyVault or local config!", ): with caplog.at_level(logging.ERROR): _ = SAPRFC(sap_credentials_key="SAP_test") diff --git a/viadot/sources/sap_rfc.py b/viadot/sources/sap_rfc.py index 8d53bd230..94d1b1f07 100644 --- a/viadot/sources/sap_rfc.py +++ b/viadot/sources/sap_rfc.py @@ -277,13 +277,13 @@ def __init__( if sap_credentials is None: logger.warning( - f"Your credentials will use {env} environment from local config. If you would like to use different one - please specified it in sap_credentials parameter." + f"Your credentials will use {env} environment from local config. If you would like to use different one - please specified it in env parameter." ) try: sap_credentials = local_config.get(sap_credentials_key).get(env) except AttributeError: raise CredentialError( - f"sap_credentials_key: {sap_credentials_key} is not stored neither in KeyVault or Local Config!" + f"sap_credentials_key: {sap_credentials_key} is not stored neither in KeyVault or local config!" ) if sap_credentials is None: raise CredentialError(f"Missing {env} credentials!") @@ -747,13 +747,13 @@ def __init__( if sap_credentials is None: logger.warning( - f"Your credentials will use {env} environment from local config. If you would like to use different one - please specified it in sap_credentials parameter." + f"Your credentials will use {env} environment from local config. If you would like to use different one - please specified it in env parameter." ) try: sap_credentials = local_config.get(sap_credentials_key).get(env) except AttributeError: raise CredentialError( - f"sap_credentials_key: {sap_credentials_key} is not stored neither in KeyVault or Local Config!" + f"sap_credentials_key: {sap_credentials_key} is not stored neither in KeyVault or local config!" ) if sap_credentials is None: raise CredentialError(f"Missing {env} credentials!")