"""Test Product Physical Change History Model.""" from ows_product_physical.connector.mysql import db_session from ows_product_physical.models \ import product_physical_change_history as change_history_model from ows_product_physical.models.product_physical_change_history \ import ProductPhysicalChangeHistory def test_create_physical_product_change_history_artwork( db_fixture, valid_date_changed, valid_create_physical_product_change_history_fields_artwork): """Test successful creation of a physical product.""" with db_session() as session: change_history_model.create( session, **valid_create_physical_product_change_history_fields_artwork) result = session.query(ProductPhysicalChangeHistory).one().to_dict() assert result == { 'id': 1, 'artworkpath': '/path/to/artwork', 'product_id': 42, 'field_name': 'artwork', 'date_changed': valid_date_changed.isoformat(), 'delivered': 'N', 'store_id': None, 'new_price': None } def test_create_physical_product_change_history_pricing( db_fixture, valid_date_changed, valid_create_physical_product_change_history_fields_pricing): """Test successful creation of a physical product.""" with db_session() as session: change_history_model.create( session, **valid_create_physical_product_change_history_fields_pricing) result = session.query(ProductPhysicalChangeHistory).one().to_dict() assert result == { 'id': 1, 'artworkpath': None, 'product_id': 42, 'field_name': 'wholesale_price', 'date_changed': valid_date_changed.isoformat(), 'delivered': 'N', 'store_id': 2, 'new_price': '25.00' }