major refactoring adding vendor and customer features
This commit is contained in:
42
tests/fixtures/customer_fixtures.py
vendored
Normal file
42
tests/fixtures/customer_fixtures.py
vendored
Normal 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
|
||||
Reference in New Issue
Block a user