Added get comments from user.
Some checks failed
devranta build / build (push) Failing after 50s

This commit is contained in:
retoor 2024-12-03 03:52:56 +01:00
parent fd2c47da45
commit 00254503af
2 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,8 @@ class Api:
self.token_Key = None
self.session = None
def patch_auth(self, request_dict=None):
auth_dict = {"app": self.app_id}
if self.auth:
@ -65,6 +67,11 @@ class Api:
await self.session.close()
self.session = None
async def get_comments_from_user(self, username):
user_id = await self.get_user_id(username)
profile = await self.get_profile(user_id)
return profile.get('content',{}).get('content',{}).get('comments',[])
async def post_comment(self, rant_id, comment):
response = None
if not await self.ensure_login():

View File

@ -17,6 +17,9 @@ class ApiTestCase(unittest.IsolatedAsyncioTestCase):
async def test_get_user_id(self):
self.assertTrue(await self.api.get_user_id("retoor"))
async def test_get_comments_from_user(self):
self.assertTrue(await self.api.get_comments_from_user("retoor"))
async def test_get_profile(self):
user_id = await self.api.get_user_id("retoor")
self.assertTrue(await self.api.get_profile(user_id))