"""Test error handling methods.""" import pytest from reserves_schedule import error_handling def test_raise_service_error(): """Test raise_service_error logs error and raises exception.""" error_msg = 'ERROR to GET /object/object_id' service = 'ows-service' with pytest.raises(error_handling.OwsServiceException) as e: error_handling.raise_service_error(error_msg, service) assert f'{service} failure: {error_msg}' in str(e.value) def test_raise_service_error_with_kwargs(): """Test raise_service_error logs error and raises exception with kwargs.""" data = {'target_id': 666} error_msg = 'ERROR to GET /object/object_id' service = 'ows-service' with pytest.raises(error_handling.OwsServiceException) as e: error_handling.raise_service_error(error_msg, service, **data) assert f'{service} failure: {error_msg} {data}' in str(e.value)