Merge branch 'main' into copilot/update-api-providers-configs

This commit is contained in:
Giacomo Bertolazzi
2025-10-27 18:53:24 +01:00
committed by GitHub
27 changed files with 464 additions and 1129 deletions

View File

@@ -16,7 +16,7 @@ class TestChanWrapper:
assert len(posts) == 2
for post in posts:
assert post.title != ""
assert post.time != ""
assert re.match(r'\d{4}-\d{2}-\d{2}', post.time)
assert post.timestamp != ""
assert re.match(r'\d{4}-\d{2}-\d{2}', post.timestamp)
assert isinstance(post.comments, list)

View File

@@ -19,7 +19,7 @@ class TestRedditWrapper:
assert len(posts) == 2
for post in posts:
assert post.title != ""
assert re.match(r'\d{4}-\d{2}-\d{2}', post.time)
assert re.match(r'\d{4}-\d{2}-\d{2}', post.timestamp)
assert isinstance(post.comments, list)
assert len(post.comments) <= MAX_COMMENTS

View File

@@ -1,11 +1,13 @@
import os
import re
import pytest
from shutil import which
from app.api.social.x import XWrapper
@pytest.mark.social
@pytest.mark.api
@pytest.mark.skipif(not os.getenv("X_API_KEY"), reason="X_API_KEY not set in environment variables")
@pytest.mark.skipif(which('rettiwt') is None, reason="rettiwt not installed")
class TestXWrapper:
def test_initialization(self):
wrapper = XWrapper()
@@ -18,5 +20,5 @@ class TestXWrapper:
assert len(posts) == 2
for post in posts:
assert post.title != ""
assert re.match(r'\d{4}-\d{2}-\d{2}', post.time)
assert re.match(r'\d{4}-\d{2}-\d{2}', post.timestamp)
assert isinstance(post.comments, list)

View File

@@ -17,7 +17,7 @@ class TestSocialAPIsTool:
assert len(result) > 0
for post in result:
assert post.title is not None
assert post.time is not None
assert post.timestamp is not None
def test_social_api_tool_get_top_all_results(self):
tool = SocialAPIsTool()
@@ -27,4 +27,4 @@ class TestSocialAPIsTool:
for _provider, posts in result.items():
for post in posts:
assert post.title is not None
assert post.time is not None
assert post.timestamp is not None