"""Unit tests for the handler utility functions.""" from owsresponse import response from asset_file_details.models import ows_product from asset_file_details.utils import handler_util def test_check_product_ownership(mocker): """Test that the function is a straight pass-through to the model.""" stupid_response = response.Response(status=123, message='duh...what?') mocker.patch.object( ows_product, 'check_ownership', autospec=True, return_value=stupid_response) account_type = 'something' account_id = 3939393 upc = 23429343 correlation_id = '123' handler_response = handler_util.check_product_ownership( account_type, account_id, upc, correlation_id) ows_product.check_ownership.assert_called_with( account_type, account_id, upc, correlation_id) assert handler_response == stupid_response