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()