| |
| """ |
| Test Name Request Functionality |
| """ |
| from customer_manager import CustomerManager |
| import os |
|
|
| |
| if os.path.exists("test_customers.json"): |
| os.remove("test_customers.json") |
|
|
| crm = CustomerManager("test_customers.json") |
|
|
| print("🧪 İsim Sorma Test Senaryoları") |
| print("="*50) |
|
|
| |
| print("\n1️⃣ REZERVASYON ANINDA İSİM SORMA") |
| phone = "+905551111111" |
| message = "Marlin 5'i rezerve edebilir miyim?" |
|
|
| customer = crm.get_or_create_customer(phone) |
| should_ask, question = crm.should_ask_for_name(phone, message) |
|
|
| print(f"Müşteri: {message}") |
| print(f"İsim sorulmalı mı: {should_ask}") |
| if question: |
| print(f"Soru: {question}") |
|
|
| |
| print("\nMüşteri yanıtı: 'Ahmet'") |
| extracted = crm.extract_name_from_response("Ahmet") |
| print(f"Çıkarılan isim: {extracted}") |
|
|
| |
| print("\n2️⃣ 3. MESAJDA NAZİKÇE SORMA") |
| phone2 = "+905552222222" |
|
|
| |
| crm.update_interaction(phone2, "Merhaba", None) |
| should_ask, question = crm.should_ask_for_name(phone2, "Merhaba") |
| print(f"1. mesaj - İsim sorulmalı: {should_ask}") |
|
|
| |
| crm.update_interaction(phone2, "FX 3 var mı?", "FX 3") |
| should_ask, question = crm.should_ask_for_name(phone2, "FX 3 var mı?") |
| print(f"2. mesaj - İsim sorulmalı: {should_ask}") |
|
|
| |
| crm.update_interaction(phone2, "Fiyatı nedir?", None) |
| should_ask, question = crm.should_ask_for_name(phone2, "Fiyatı nedir?") |
| print(f"3. mesaj - İsim sorulmalı: {should_ask}") |
| if question: |
| print(f"Soru: {question}") |
|
|
| |
| print("\n3️⃣ İSİM ÇIKARMA TESTLERİ") |
| test_responses = [ |
| "Mehmet", |
| "benim adım Ali", |
| "Ben Ayşe", |
| "Adım Fatma", |
| "ismim Hasan", |
| "Veli, teşekkürler", |
| "Ahmet Yılmaz", |
| "selam" |
| ] |
|
|
| for response in test_responses: |
| extracted = crm.extract_name_from_response(response) |
| print(f"'{response}' -> {extracted if extracted else 'İsim bulunamadı'}") |
|
|
| |
| print("\n4️⃣ MAĞAZA ZİYARETİ ANINDA") |
| phone3 = "+905553333333" |
| message = "Yarın mağazaya gelerek test sürüşü yapabilir miyim?" |
| should_ask, question = crm.should_ask_for_name(phone3, message) |
| print(f"Müşteri: {message}") |
| print(f"İsim sorulmalı: {should_ask}") |
| if question: |
| print(f"Soru: {question}") |
|
|
| |
| print("\n5️⃣ ÖDEME GÖRÜŞMESİ ANINDA") |
| phone4 = "+905554444444" |
| message = "12 taksit yapıyor musunuz?" |
| should_ask, question = crm.should_ask_for_name(phone4, message) |
| print(f"Müşteri: {message}") |
| print(f"İsim sorulmalı: {should_ask}") |
| if question: |
| print(f"Soru: {question}") |
|
|
| |
| print("\n6️⃣ POTANSİYEL MÜŞTERİ (5+ SORGU)") |
| phone5 = "+905555555555" |
| for i in range(5): |
| crm.update_interaction(phone5, f"Soru {i+1}", None) |
|
|
| should_ask, question = crm.should_ask_for_name(phone5, "Başka model var mı?") |
| print(f"5+ sorgudan sonra") |
| print(f"İsim sorulmalı: {should_ask}") |
| if question: |
| print(f"Soru: {question}") |
|
|
| print("\n" + "="*50) |
| print("✅ Testler Tamamlandı!") |
|
|
| |
| if os.path.exists("test_customers.json"): |
| os.remove("test_customers.json") |