Marketplace tests update
This commit is contained in:
@@ -10,7 +10,7 @@ This module provides classes and functions for:
|
||||
"""
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Optional
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -68,7 +68,7 @@ class StockService:
|
||||
# Update existing stock (SET to exact quantity)
|
||||
old_quantity = existing_stock.quantity
|
||||
existing_stock.quantity = stock_data.quantity
|
||||
existing_stock.updated_at = datetime.utcnow()
|
||||
existing_stock.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
db.refresh(existing_stock)
|
||||
|
||||
@@ -128,7 +128,7 @@ class StockService:
|
||||
# Add to existing stock
|
||||
old_quantity = existing_stock.quantity
|
||||
existing_stock.quantity += stock_data.quantity
|
||||
existing_stock.updated_at = datetime.utcnow()
|
||||
existing_stock.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
db.refresh(existing_stock)
|
||||
|
||||
@@ -207,7 +207,7 @@ class StockService:
|
||||
raise NegativeStockException(normalized_gtin, location, new_quantity)
|
||||
|
||||
existing_stock.quantity = new_quantity
|
||||
existing_stock.updated_at = datetime.utcnow()
|
||||
existing_stock.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
db.refresh(existing_stock)
|
||||
|
||||
@@ -381,7 +381,7 @@ class StockService:
|
||||
self._validate_quantity(stock_update.quantity, allow_zero=True)
|
||||
|
||||
stock_entry.quantity = stock_update.quantity
|
||||
stock_entry.updated_at = datetime.utcnow()
|
||||
stock_entry.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
db.refresh(stock_entry)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user