first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:20:45 +03:00
commit d50f14bcb1
681 changed files with 65020 additions and 0 deletions

54
test_contact_api.py Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python
"""
Contact API Test Script
Bu script contact endpoint'ini test eder ve email gönderimini kontrol eder.
"""
import requests
import json
# API endpoint
BASE_URL = "http://127.0.0.1:8000"
CONTACT_URL = f"{BASE_URL}/api/v1/contact/create/"
# Test data
test_contact = {
"name": "Test Kullanıcı",
"email": "test@example.com",
"subject": "Test Konusu",
"message": "Bu bir test mesajıdır. Celery ile email gönderimi test ediliyor."
}
print("=" * 60)
print("Contact API Test")
print("=" * 60)
print(f"\nEndpoint: {CONTACT_URL}")
print(f"\nTest Data:")
print(json.dumps(test_contact, indent=2, ensure_ascii=False))
print("\n" + "=" * 60)
try:
# POST request gönder
response = requests.post(CONTACT_URL, json=test_contact)
print(f"\nResponse Status Code: {response.status_code}")
print(f"Response Headers: {dict(response.headers)}")
if response.status_code == 201:
print("\n✅ Contact başarıyla oluşturuldu!")
print(f"\nResponse Data:")
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
print("\n📧 Email gönderimi için Celery worker'ı kontrol edin.")
print(" MailPit: http://localhost:8025")
else:
print(f"\n❌ Hata! Status Code: {response.status_code}")
print(f"Response: {response.text}")
except requests.exceptions.ConnectionError:
print("\n❌ Bağlantı hatası! Django sunucusu çalışıyor mu?")
print(" Sunucuyu başlatmak için: python manage.py runserver")
except Exception as e:
print(f"\n❌ Beklenmeyen hata: {str(e)}")
print("\n" + "=" * 60)