"""Tests for ows_product model.""" from models import ows_product import pytest from models.api_exceptions import PersistentException def test_get_product_info_success( mocker, product_info_success_response, product_id, product_info_fixture): """Test get product info from ows-product success.""" mocker.patch( 'requests.get', return_value=product_info_success_response) result = ows_product.get_product_info(product_id) assert result == product_info_fixture def test_get_product_info_not_found( mocker, ows_not_found_response, product_id): """Test get product info from ows-product not found.""" mocker.patch('requests.get', return_value=ows_not_found_response) with pytest.raises(PersistentException): ows_product.get_product_info(product_id) def test_get_product_info_error( mocker, ows_error_response, product_id): """Test get product info from ows-product error.""" mocker.patch('requests.get', return_value=ows_error_response) with pytest.raises(PersistentException): ows_product.get_product_info(product_id)