File size: 816 Bytes
37c6d1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests

def test_generate_endpoint():
    url = "http://127.0.0.1:8000/generate"
    payload = {
        "text": "Hello",
        "murf_api_key": "dummy_key",
        "voice_id": "en-US-marcus"
    }
    
    print("Testing /generate endpoint...")
    response = requests.post(url, json=payload)
    
    # We expect 400 because the key is dummy, but this proves the endpoint exists and calls Murf
    if response.status_code == 400:
        print("PASS: Endpoint exists and returned 400 as expected (Invalid Key).")
        print("Response:", response.json())
    elif response.status_code == 200:
        print("FAIL: Unexpected Success with dummy key?")
    else:
        print(f"FAIL: Status {response.status_code}")
        print(response.text)

if __name__ == "__main__":
    test_generate_endpoint()