"""Tests for ows-product model.""" from oto import response from conflict_manager.constants import services from conflict_manager.models import ows_product from tests import testutils PRODUCT_ID = 223 ERROR_RESPONSE = response.create_error_response( code=services.SERVICE_ERROR_CODES[services.OWS_PRODUCT], message='Server error.' ) def test_ows_response( mocker, ows_not_found_response, ows_product_succesful_response): """Test successful, not_found and error responses from ows-product.""" # pytest.mark.parametrize with fixtures is not supported test_cases = [ ows_not_found_response, ows_product_succesful_response, ERROR_RESPONSE ] for expected_response in test_cases: mock_ows = testutils.patch_get_from_ows_service( mocker, expected_response) product_response = ows_product.get_product_by_product_id(PRODUCT_ID) endpoint = '/product/{}'.format(PRODUCT_ID) service = services.OWS_PRODUCT mock_ows.assert_called_with(service, endpoint) assert product_response == expected_response