From 25a2e6f7cc500e5363b398d2301ef1adaf30bcdc Mon Sep 17 00:00:00 2001 From: Marvin Date: Sun, 15 Mar 2026 10:11:19 -0300 Subject: [PATCH] Update test script for comprehensive testing --- test_api.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test_api.py b/test_api.py index 2842ac2..c4fef77 100644 --- a/test_api.py +++ b/test_api.py @@ -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()