- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
# 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)
|
|
# Expunge customer from session to prevent ResourceWarning about unclosed connections
|
|
db.expunge(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)
|
|
# Expunge address from session to prevent ResourceWarning about unclosed connections
|
|
db.expunge(address)
|
|
return address
|