def test_siriusxm_serivce_health_on_exception_returns_500( patched_rest_client, mock_dynamo_cv_table, programcode): patched_rest_client.get.side_effect = Exception siriusxm_service = SiriusXmService( config=SiriusXmConfig(base_url="https://success"), table=mock_dynamo_cv_table, ) response = siriusxm_service.health(programcode, CtsVersion.TWO_DOT_ZERO) assert type(response) == VehicleData assert response.status == InternalStatusType.INTERNALSERVERERROR
def test_siriusxm_serivce_health_on_success_returns_200( programcode, patched_rest_client, mock_dynamo_cv_table): patched_rest_client.get.side_effect = mocked_requests_get siriusxmservice = SiriusXmService( config=SiriusXmConfig(base_url="https://success"), table=mock_dynamo_cv_table, ) response = siriusxmservice.health(programcode, CtsVersion.TWO_DOT_ZERO) assert type(response) == VehicleData assert response.status == InternalStatusType.SUCCESS assert response.responsemessage == "HealthCheck passed"
def test_siriusxm_serivce_health_on_error_returns_expected_response( programcode, patched_rest_client, mock_dynamo_cv_table, base_url, status, message, ): patched_rest_client.get.side_effect = mocked_requests_get siriusxmservice = SiriusXmService( config=SiriusXmConfig(base_url=base_url), table=mock_dynamo_cv_table, ) response = siriusxmservice.health(programcode, CtsVersion.TWO_DOT_ZERO) assert type(response) == VehicleData assert response.status == status assert response.responsemessage == message