Skip to content

Commit

Permalink
integration tests for avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyagreco committed Sep 9, 2024
1 parent fa87fa2 commit 0f96dfe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,8 @@ dmypy.json

# all files with "_dnm." in them like foo_dnm.py (dnm = do not merge)
*_dnm.*
*_dnc.*

.DS_Store


1 change: 1 addition & 0 deletions test/integration/test_api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@
# USER B
USER_B_USER_ID = "589073650351644672"
USER_B_USERNAME = "sleeper"
USER_B_AVATAR_ID = "d9a0519df672516d2b6fce037f374456"
USER_B_USER = {
"avatar": "d9a0519df672516d2b6fce037f374456",
"cookies": None,
Expand Down
19 changes: 19 additions & 0 deletions test/integration/test_api/test_avatar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
import unittest

from sleeper.api.avatar import get_avatar
from test.integration.test_api.constants import USER_B_AVATAR_ID


class TestAvatar(unittest.TestCase):
_PATH_TO_TEST_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "util", "bin")
)

with open(os.path.join(_PATH_TO_TEST_DIR, "sleeper.bin"), "rb") as image:
SLEEPER_AVATAR_BYTES = image.read()

def test_get_avatar(self):
response = get_avatar(avatar_id=USER_B_AVATAR_ID)

self.assertEqual(self.SLEEPER_AVATAR_BYTES, response)
Binary file added test/integration/util/bin/sleeper.bin
Binary file not shown.

0 comments on commit 0f96dfe

Please sign in to comment.