File size: 1,530 Bytes
af1d8cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import json

BASE_URL = "http://localhost:8001"

def test_outfit_gen():
    print("Testing Smart Outfit Generation...")
    
    # 1. Ensure user has items (Seeding if needed)
    # We can assume user 1 exists from previous steps. 
    # Just in case, let's verify wardrobe count.
    res = requests.get(f"{BASE_URL}/wardrobe/1")
    items = res.json()
    print(f"User 1 Wardrobe Size: {len(items)}")
    for i in items:
        print(f" - {i['id']}: {i['category']} ({i.get('tags')})")
    
    if len(items) < 2:
        print("⚠️ Not enough items. Please upload items manually or run previous seeds.")
        # We can't easily upload here without images. 
        # But Phase 7 verification should have left some items.
    
    res = requests.post(f"{BASE_URL}/outfit/generate/1")
    if res.status_code == 200:
        data = res.json()
        print(f"RAW RESP: {data}")
        print("\n--- GENERATED OUTFIT ---")
        print(f"Outfit ID: {data.get('outfit_id')}")
        print(f"Style Note: {data.get('note')}") # CRITICAL: This checks the new engine
        
        print("Items:")
        for item in data.get('items', []):
            print(f" - {item['category'].upper()}: {item.get('tags', 'untagged')}")
            
        if "note" in data:
             print("✅ SUCCESS: Smart Engine active (Note present)")
        else:
             print("❌ FAILURE: Old logic active (No note)")
    else:
        print(f"❌ Error: {res.text}")

if __name__ == "__main__":
    test_outfit_gen()