Fixing vendor dashboard area

This commit is contained in:
2025-11-21 23:15:25 +01:00
parent 5aff76a27e
commit 86f1e16ef2
38 changed files with 312 additions and 433 deletions

View File

@@ -27,6 +27,39 @@ def test_vendor(db, test_user):
return vendor
@pytest.fixture
def test_vendor_with_vendor_user(db, test_vendor_user):
"""Create a vendor owned by a vendor user (for testing vendor API endpoints)"""
from models.database.vendor import VendorUser
unique_id = str(uuid.uuid4())[:8].upper()
vendor = Vendor(
vendor_code=f"VENDORAPI_{unique_id}",
subdomain=f"vendorapi{unique_id.lower()}",
name=f"Vendor API Test {unique_id}",
owner_user_id=test_vendor_user.id,
is_active=True,
is_verified=True,
)
db.add(vendor)
db.commit()
db.refresh(vendor)
# Create VendorUser association
vendor_user = VendorUser(
vendor_id=vendor.id,
user_id=test_vendor_user.id,
is_owner=True,
is_active=True,
)
db.add(vendor_user)
db.commit()
db.refresh(vendor)
db.expunge(vendor)
return vendor
@pytest.fixture
def unique_vendor(db, test_user):
"""Create a unique vendor for tests that need isolated vendor data"""