major refactoring adding vendor and customer features

This commit is contained in:
2025-10-11 09:09:25 +02:00
parent f569995883
commit dd16198276
126 changed files with 15109 additions and 3747 deletions

42
tests/fixtures/customer_fixtures.py vendored Normal file
View File

@@ -0,0 +1,42 @@
# tests/fixtures/customer_fixtures.py
import pytest
from models.database.customer import Customer, CustomerAddress
@pytest.fixture
def test_customer(db, test_vendor):
"""Create a test customer"""
customer = Customer(
vendor_id=test_vendor.id,
email="testcustomer@example.com",
hashed_password="hashed_password",
first_name="John",
last_name="Doe",
customer_number="TEST001",
is_active=True,
)
db.add(customer)
db.commit()
db.refresh(customer)
return customer
@pytest.fixture
def test_customer_address(db, test_vendor, test_customer):
"""Create a test customer address"""
address = CustomerAddress(
vendor_id=test_vendor.id,
customer_id=test_customer.id,
address_type="shipping",
first_name="John",
last_name="Doe",
address_line_1="123 Main St",
city="Luxembourg",
postal_code="L-1234",
country="Luxembourg",
is_default=True,
)
db.add(address)
db.commit()
db.refresh(address)
return address