refactor: modernize code quality tooling with Ruff
- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter) - Add comprehensive pyproject.toml configuration - Simplify Makefile code quality targets - Configure exclusions for venv/.venv in pyproject.toml - Auto-fix 1,359 linting issues across codebase Benefits: - Much faster builds (Ruff is written in Rust) - Single tool replaces multiple tools - More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q) - All configuration centralized in pyproject.toml - Better import sorting and formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,6 @@ Tests:
|
||||
- Transfer ownership
|
||||
"""
|
||||
|
||||
import json
|
||||
from pprint import pprint
|
||||
|
||||
import requests
|
||||
|
||||
@@ -35,10 +33,9 @@ def login_admin():
|
||||
ADMIN_TOKEN = data["access_token"]
|
||||
print("✅ Admin login successful")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Admin login failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
print(f"❌ Admin login failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
|
||||
|
||||
def get_headers():
|
||||
@@ -71,18 +68,17 @@ def test_create_vendor_with_both_emails():
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print("✅ Vendor created successfully")
|
||||
print(f"\n📧 Emails:")
|
||||
print("\n📧 Emails:")
|
||||
print(f" Owner Email: {data['owner_email']}")
|
||||
print(f" Contact Email: {data['contact_email']}")
|
||||
print(f"\n🔑 Credentials:")
|
||||
print("\n🔑 Credentials:")
|
||||
print(f" Username: {data['owner_username']}")
|
||||
print(f" Password: {data['temporary_password']}")
|
||||
print(f"\n🔗 Login URL: {data['login_url']}")
|
||||
return data["id"]
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return None
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return None
|
||||
|
||||
|
||||
def test_create_vendor_single_email():
|
||||
@@ -106,7 +102,7 @@ def test_create_vendor_single_email():
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print("✅ Vendor created successfully")
|
||||
print(f"\n📧 Emails:")
|
||||
print("\n📧 Emails:")
|
||||
print(f" Owner Email: {data['owner_email']}")
|
||||
print(f" Contact Email: {data['contact_email']}")
|
||||
|
||||
@@ -116,10 +112,9 @@ def test_create_vendor_single_email():
|
||||
print("❌ Contact email should have defaulted to owner email")
|
||||
|
||||
return data["id"]
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return None
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return None
|
||||
|
||||
|
||||
def test_update_vendor_contact_email(vendor_id):
|
||||
@@ -142,15 +137,14 @@ def test_update_vendor_contact_email(vendor_id):
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print("✅ Vendor updated successfully")
|
||||
print(f"\n📧 Emails after update:")
|
||||
print("\n📧 Emails after update:")
|
||||
print(f" Owner Email: {data['owner_email']} (unchanged)")
|
||||
print(f" Contact Email: {data['contact_email']} (updated)")
|
||||
print(f"\n📝 Name: {data['name']} (updated)")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
|
||||
|
||||
def test_get_vendor_details(vendor_id):
|
||||
@@ -166,22 +160,21 @@ def test_get_vendor_details(vendor_id):
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print("✅ Vendor details retrieved")
|
||||
print(f"\n📋 Vendor Info:")
|
||||
print("\n📋 Vendor Info:")
|
||||
print(f" ID: {data['id']}")
|
||||
print(f" Code: {data['vendor_code']}")
|
||||
print(f" Name: {data['name']}")
|
||||
print(f" Subdomain: {data['subdomain']}")
|
||||
print(f"\n👤 Owner Info:")
|
||||
print("\n👤 Owner Info:")
|
||||
print(f" Username: {data['owner_username']}")
|
||||
print(f" Email: {data['owner_email']}")
|
||||
print(f"\n📧 Contact Info:")
|
||||
print("\n📧 Contact Info:")
|
||||
print(f" Email: {data['contact_email']}")
|
||||
print(f" Phone: {data.get('contact_phone', 'N/A')}")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
|
||||
|
||||
def test_transfer_ownership(vendor_id, new_owner_user_id):
|
||||
@@ -197,7 +190,7 @@ def test_transfer_ownership(vendor_id, new_owner_user_id):
|
||||
|
||||
if response.status_code == 200:
|
||||
current_data = response.json()
|
||||
print(f"\n📋 Current Owner:")
|
||||
print("\n📋 Current Owner:")
|
||||
print(f" User ID: {current_data['owner_user_id']}")
|
||||
print(f" Username: {current_data['owner_username']}")
|
||||
print(f" Email: {current_data['owner_email']}")
|
||||
@@ -218,21 +211,20 @@ def test_transfer_ownership(vendor_id, new_owner_user_id):
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print(f"\n✅ {data['message']}")
|
||||
print(f"\n👤 Old Owner:")
|
||||
print("\n👤 Old Owner:")
|
||||
print(f" ID: {data['old_owner']['id']}")
|
||||
print(f" Username: {data['old_owner']['username']}")
|
||||
print(f" Email: {data['old_owner']['email']}")
|
||||
print(f"\n👤 New Owner:")
|
||||
print("\n👤 New Owner:")
|
||||
print(f" ID: {data['new_owner']['id']}")
|
||||
print(f" Username: {data['new_owner']['username']}")
|
||||
print(f" Email: {data['new_owner']['email']}")
|
||||
print(f"\n📝 Reason: {data['transfer_reason']}")
|
||||
print(f"⏰ Transferred at: {data['transferred_at']}")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
print(f"❌ Failed: {response.status_code}")
|
||||
print(response.text)
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user