style: apply black and isort formatting across entire codebase
- 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>
This commit is contained in:
@@ -9,10 +9,11 @@ Tests:
|
||||
- Transfer ownership
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
from pprint import pprint
|
||||
|
||||
import requests
|
||||
|
||||
BASE_URL = "http://localhost:8000"
|
||||
ADMIN_TOKEN = None # Will be set after login
|
||||
|
||||
@@ -25,8 +26,8 @@ def login_admin():
|
||||
f"{BASE_URL}/api/v1/admin/auth/login", # ✅ Changed: added /admin/
|
||||
json={
|
||||
"username": "admin", # Replace with your admin username
|
||||
"password": "admin123" # Replace with your admin password
|
||||
}
|
||||
"password": "admin123", # Replace with your admin password
|
||||
},
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -44,7 +45,7 @@ def get_headers():
|
||||
"""Get authorization headers."""
|
||||
return {
|
||||
"Authorization": f"Bearer {ADMIN_TOKEN}",
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
|
||||
@@ -60,13 +61,11 @@ def test_create_vendor_with_both_emails():
|
||||
"subdomain": "testdual",
|
||||
"owner_email": "owner@testdual.com",
|
||||
"contact_email": "contact@testdual.com",
|
||||
"description": "Test vendor with separate emails"
|
||||
"description": "Test vendor with separate emails",
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{BASE_URL}/api/v1/admin/vendors",
|
||||
headers=get_headers(),
|
||||
json=vendor_data
|
||||
f"{BASE_URL}/api/v1/admin/vendors", headers=get_headers(), json=vendor_data
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -79,7 +78,7 @@ def test_create_vendor_with_both_emails():
|
||||
print(f" Username: {data['owner_username']}")
|
||||
print(f" Password: {data['temporary_password']}")
|
||||
print(f"\n🔗 Login URL: {data['login_url']}")
|
||||
return data['id']
|
||||
return data["id"]
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
@@ -97,13 +96,11 @@ def test_create_vendor_single_email():
|
||||
"name": "Test Single Email Vendor",
|
||||
"subdomain": "testsingle",
|
||||
"owner_email": "owner@testsingle.com",
|
||||
"description": "Test vendor with single email"
|
||||
"description": "Test vendor with single email",
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{BASE_URL}/api/v1/admin/vendors",
|
||||
headers=get_headers(),
|
||||
json=vendor_data
|
||||
f"{BASE_URL}/api/v1/admin/vendors", headers=get_headers(), json=vendor_data
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -113,12 +110,12 @@ def test_create_vendor_single_email():
|
||||
print(f" Owner Email: {data['owner_email']}")
|
||||
print(f" Contact Email: {data['contact_email']}")
|
||||
|
||||
if data['owner_email'] == data['contact_email']:
|
||||
if data["owner_email"] == data["contact_email"]:
|
||||
print("✅ Contact email correctly defaulted to owner email")
|
||||
else:
|
||||
print("❌ Contact email should have defaulted to owner email")
|
||||
|
||||
return data['id']
|
||||
return data["id"]
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
@@ -133,13 +130,13 @@ def test_update_vendor_contact_email(vendor_id):
|
||||
|
||||
update_data = {
|
||||
"contact_email": "newcontact@business.com",
|
||||
"name": "Updated Vendor Name"
|
||||
"name": "Updated Vendor Name",
|
||||
}
|
||||
|
||||
response = requests.put(
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}",
|
||||
headers=get_headers(),
|
||||
json=update_data
|
||||
json=update_data,
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -163,8 +160,7 @@ def test_get_vendor_details(vendor_id):
|
||||
print("=" * 60)
|
||||
|
||||
response = requests.get(
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}",
|
||||
headers=get_headers()
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}", headers=get_headers()
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -196,8 +192,7 @@ def test_transfer_ownership(vendor_id, new_owner_user_id):
|
||||
|
||||
# First, get current owner info
|
||||
response = requests.get(
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}",
|
||||
headers=get_headers()
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}", headers=get_headers()
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -211,13 +206,13 @@ def test_transfer_ownership(vendor_id, new_owner_user_id):
|
||||
transfer_data = {
|
||||
"new_owner_user_id": new_owner_user_id,
|
||||
"confirm_transfer": True,
|
||||
"transfer_reason": "Testing ownership transfer feature"
|
||||
"transfer_reason": "Testing ownership transfer feature",
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
f"{BASE_URL}/api/v1/admin/vendors/{vendor_id}/transfer-ownership",
|
||||
headers=get_headers(),
|
||||
json=transfer_data
|
||||
json=transfer_data,
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
|
||||
Reference in New Issue
Block a user