@@ -1012,14 +1012,13 @@ def test_customer_returns_client_id_from_credentials(self):
10121012
10131013 assert result == "customer-client-id"
10141014
1015- def test_customer_returns_empty_string_on_load_failure (self ):
1015+ def test_customer_raises_on_load_failure (self ):
10161016 with (
10171017 patch (_DETECT_CREDS_PATCH , return_value = "/etc/ums/credentials/credentials" ),
10181018 patch (_LOAD_CREDS_PATCH , side_effect = Exception ("parse error" )),
10191019 ):
1020- result = create_client ().get_ias_client_id ()
1021-
1022- assert result == ""
1020+ with pytest .raises (AgentGatewaySDKError , match = "Could not resolve IAS client ID" ):
1021+ create_client ().get_ias_client_id ()
10231022
10241023 # --- LoB flow ---
10251024
@@ -1031,11 +1030,10 @@ def test_lob_returns_client_id_from_destination_properties(self, _mock_detect):
10311030 assert result == "lob-client-id"
10321031
10331032 @_NO_CUSTOMER_CREDS
1034- def test_lob_returns_empty_string_when_destination_not_found (self , _mock_detect ):
1035- with patch (_GET_IAS_CLIENT_ID_LOB_PATCH , return_value = "" ):
1036- result = create_client (tenant_subdomain = "my-tenant" ).get_ias_client_id ()
1037-
1038- assert result == ""
1033+ def test_lob_raises_when_destination_not_found (self , _mock_detect ):
1034+ with patch (_GET_IAS_CLIENT_ID_LOB_PATCH , side_effect = AgentGatewaySDKError ("IAS destination 'sap-managed-runtime-ias-eu10' not found" )):
1035+ with pytest .raises (AgentGatewaySDKError , match = "IAS destination" ):
1036+ create_client (tenant_subdomain = "my-tenant" ).get_ias_client_id ()
10391037
10401038 @_NO_CUSTOMER_CREDS
10411039 def test_lob_returns_empty_string_when_property_absent (self , _mock_detect ):
@@ -1045,13 +1043,7 @@ def test_lob_returns_empty_string_when_property_absent(self, _mock_detect):
10451043 assert result == ""
10461044
10471045 @_NO_CUSTOMER_CREDS
1048- def test_lob_returns_empty_string_and_logs_warning_on_exception (self , _mock_detect ):
1049- with (
1050- patch (_GET_IAS_CLIENT_ID_LOB_PATCH , side_effect = EnvironmentError ("APPFND_CONHOS_LANDSCAPE not set" )),
1051- patch ("sap_cloud_sdk.agentgateway.agw_client.logger" ) as mock_logger ,
1052- ):
1053- result = create_client (tenant_subdomain = "my-tenant" ).get_ias_client_id ()
1054-
1055- assert result == ""
1056- mock_logger .warning .assert_called_once ()
1057- assert "clientId" in mock_logger .warning .call_args [0 ][0 ]
1046+ def test_lob_raises_on_exception (self , _mock_detect ):
1047+ with patch (_GET_IAS_CLIENT_ID_LOB_PATCH , side_effect = EnvironmentError ("APPFND_CONHOS_LANDSCAPE not set" )):
1048+ with pytest .raises (AgentGatewaySDKError , match = "Could not resolve IAS client ID" ):
1049+ create_client (tenant_subdomain = "my-tenant" ).get_ias_client_id ()
0 commit comments