"""Tests for ows-product Model.""" import pytest from _pytest.monkeypatch import MonkeyPatch from owsrequest import request, test_utils from carveouts.constants import service_name from carveouts.models import ows_product @pytest.mark.parametrize("status_code", [200, 403]) def test_check_ownership(monkeypatch: MonkeyPatch, status_code: int) -> None: """Test ownership of a product by vendor.""" product_id = 123 account_type = "vendor" account_id = 7123 path = "/{account_type}/{account_id}/product/{product_id}".format( account_type=account_type, account_id=account_id, product_id=product_id ) call_specs = [ {"service": service_name.OWS_PRODUCT, "path": path, "status": status_code} ] monkeypatch.setattr(request, "head", test_utils.mock_ows_requests(call_specs)) ownership_response = ows_product.check_ownership( product_id, account_type, account_id ) assert ownership_response.status_code == status_code