Update test script for comprehensive testing

This commit is contained in:
Marvin 2026-03-15 10:11:19 -03:00
parent da13778063
commit 25a2e6f7cc
1 changed files with 20 additions and 0 deletions

View File

@ -53,6 +53,26 @@ def test_custom():
print(f"Error: {data['Error']}")
def test_include_comments_false():
"""Test that include_comments=false skips comment extraction."""
url = "http://localhost:8000/scrape/subreddit/python"
params = {"limit": 1, "time_range": "week", "include_comments": False}
response = requests.get(url, params=params)
print("\n=== Include Comments=False Test ===")
data = response.json()
if "Error" not in data:
print(f"Request with include_comments=false successful")
print(f"Posts found: {data['posts_count']}")
if data.get('data'):
post = data['data'][0]
has_comments = 'comments' in post and len(post['comments']) > 0
print(f"Has comments field: {'comments' in post}")
print(f"Comments empty: {not has_comments}")
else:
print(f"Error: {data['Error']}")
if __name__ == "__main__":
try:
test_health()