mirror of
https://github.com/vee1e/InstaFuel_Chatbot_public.git
synced 2026-09-01 18:57:24 +00:00
42 lines
1 KiB
Python
42 lines
1 KiB
Python
|
|
import sys
|
|
import os
|
|
|
|
# Add src to python path
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), "../src"))
|
|
|
|
from utils import stringify_dict
|
|
|
|
def test_product_formatting():
|
|
product_with_url = {
|
|
"name": "Test Product",
|
|
"price": "100",
|
|
"product_url": "https://example.com/product"
|
|
}
|
|
|
|
product_with_link = {
|
|
"name": "Test Product 2",
|
|
"price": "200",
|
|
"link": "https://example.com/product2"
|
|
}
|
|
|
|
print("--- Test 1: product_url ---")
|
|
output1 = stringify_dict(product_with_url)
|
|
print(output1)
|
|
|
|
if "https://example.com/product" in output1:
|
|
print("PASS: URL found in output")
|
|
else:
|
|
print("FAIL: URL not found in output")
|
|
|
|
print("\n--- Test 2: link ---")
|
|
output2 = stringify_dict(product_with_link)
|
|
print(output2)
|
|
|
|
if "https://example.com/product2" in output2:
|
|
print("PASS: Link found in output")
|
|
else:
|
|
print("FAIL: Link not found in output")
|
|
|
|
if __name__ == "__main__":
|
|
test_product_formatting()
|