Merge branch 'main' into 19-team-instructions

This commit is contained in:
2025-10-20 16:59:08 +02:00
14 changed files with 264 additions and 67 deletions

View File

@@ -0,0 +1,22 @@
import re
import pytest
from app.api.social.chan import ChanWrapper
@pytest.mark.social
@pytest.mark.api
class TestChanWrapper:
def test_initialization(self):
wrapper = ChanWrapper()
assert wrapper is not None
def test_get_top_crypto_posts(self):
wrapper = ChanWrapper()
posts = wrapper.get_top_crypto_posts(limit=2)
assert isinstance(posts, list)
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 isinstance(post.comments, list)

View File

@@ -1,4 +1,5 @@
import os
import re
import pytest
from app.api.social.reddit import MAX_COMMENTS, RedditWrapper
@@ -18,6 +19,8 @@ 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 isinstance(post.comments, list)
assert len(post.comments) <= MAX_COMMENTS
for comment in post.comments:

View File

@@ -0,0 +1,22 @@
import os
import re
import pytest
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")
class TestXWrapper:
def test_initialization(self):
wrapper = XWrapper()
assert wrapper is not None
def test_get_top_crypto_posts(self):
wrapper = XWrapper()
posts = wrapper.get_top_crypto_posts(limit=2)
assert isinstance(posts, list)
assert len(posts) == 2
for post in posts:
assert post.title != ""
assert re.match(r'\d{4}-\d{2}-\d{2}', post.time)
assert isinstance(post.comments, list)