"""Tests for exception handler.""" from unittest.mock import patch from product_configuration import api from product_configuration import handlers # noqa (handlers are imported for test client) import pytest from werkzeug.exceptions import InternalServerError @pytest.fixture def fixture_client(): """Create an api test client fixture.""" return api.app.test_client() @patch('product_configuration.handlers.jsonify', side_effect=InternalServerError) def test_exception_handler(mock_jsonify, fixture_client): """Test an uncaught Exception results in a 500 status code.""" result = fixture_client.get('/hello/') assert result.status_code == 500