Skip to content

Commit e5a05cb

Browse files
committed
test: user
also fixes 1 more with statement
1 parent 0353ac7 commit e5a05cb

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

scratchattach/site/user.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,8 @@ def activity_html(self, *, limit=1000):
703703
Returns:
704704
str: The raw user activity HTML data
705705
"""
706-
return requests.get(f"https://scratch.mit.edu/messages/ajax/user-activity/?user={self.username}&max={limit}").text
706+
with requests.no_error_handling():
707+
return requests.get(f"https://scratch.mit.edu/messages/ajax/user-activity/?user={self.username}&max={limit}").text
707708

708709

709710
def follow(self):
@@ -772,7 +773,8 @@ def comments(self, *, page=1, limit=None) -> list[comment.Comment]:
772773
URL = f"https://scratch.mit.edu/site-api/comments/user/{self.username}/?page={page}"
773774
DATA = []
774775

775-
page_contents = requests.get(URL).content
776+
with requests.no_error_handling():
777+
page_contents = requests.get(URL).content
776778

777779
soup = BeautifulSoup(page_contents, "html.parser")
778780

tests/test_user.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pprint
12
import sys
23

34

@@ -77,6 +78,10 @@ def test_import():
7778
assert griffpatch.activity_html()
7879
# (un)follow, delete comment, report comment,
7980
comment = user.comments()[0]
80-
assert comment.id == 387076703
81+
assert int(comment.id) == 387076703
8182
assert comment.content == "Sample comment"
83+
# comment by id, message_events, verificator
8284

85+
status_data = user.ocular_status()
86+
assert status_data["status"] == "Sample status"
87+
assert status_data["color"] == "#855cd6"

0 commit comments

Comments
 (0)