"""Tests for GetProductPhysicalChangeHistorySchema.""" from marshmallow import ValidationError import pytest from ows_product_physical.schemas.handlers.get_physical_product_change_history\ import GetProductPhysicalChangeHistorySchema @pytest.mark.parametrize('valid_payload', [ {'product_ids': '2136606', 'store_id': 696}, {'product_ids': '2136606,3706158', 'store_id': 1705}, ]) def test_get_history_schema_valid_payload(valid_payload): """Test that a valid payload will be serialized correctly.""" try: GetProductPhysicalChangeHistorySchema().load(valid_payload) assert True except ValidationError: assert False @pytest.mark.parametrize('invalid_payload', [ # incorrect data {}, {'product_ids': '', 'store_id': 696}, {'product_ids': 'foo', 'store_id': 696}, {'product_ids': '2136606', 'store_id': 'foo'}, ]) def test_order_schema_invalid_payloads(invalid_payload): """Test that invalid payloads generate errors.""" try: GetProductPhysicalChangeHistorySchema().load(invalid_payload) assert False except ValidationError: assert True