Skip to content

Commit

Permalink
Add reactions to testAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Nov 10, 2023
1 parent 9f274ad commit 8afb56b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 35 deletions.
33 changes: 24 additions & 9 deletions tests/IssueComment.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,46 @@
class IssueComment(Framework.TestCase):
def setUp(self):
super().setUp()
self.comment = self.g.get_user().get_repo("PyGithub").get_issue(28).get_comment(5808311)
self.comment = self.g.get_repo("PyGithub/PyGithub").get_issue(28).get_comment(20227753)

def testAttributes(self):
self.assertEqual(self.comment.body, "Comment created by PyGithub")
self.assertEqual(self.comment.body, "Comment created by PyGithub\n")
self.assertEqual(
self.comment.created_at,
datetime(2012, 5, 20, 11, 46, 42, tzinfo=timezone.utc),
datetime(2013, 6, 29, 10, 31, 38, tzinfo=timezone.utc),
)
self.assertEqual(self.comment.id, 5808311)
self.assertEqual(self.comment.id, 20227753)
self.assertEqual(
self.comment.updated_at,
datetime(2012, 5, 20, 11, 46, 42, tzinfo=timezone.utc),
datetime(2013, 6, 29, 10, 31, 38, tzinfo=timezone.utc),
)
self.assertEqual(
self.comment.url,
"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311",
"https://api.github.com/repos/PyGithub/PyGithub/issues/comments/20227753",
)
self.assertEqual(self.comment.user.login, "jacquev6")
self.assertEqual(self.comment.user.login, "stuglaser")
self.assertEqual(
self.comment.html_url,
"https://github.com/jacquev6/PyGithub/issues/28#issuecomment-5808311",
"https://github.com/PyGithub/PyGithub/issues/28#issuecomment-20227753",
)
self.assertEqual(
repr(self.comment),
'IssueComment(user=NamedUser(login="jacquev6"), id=5808311)',
'IssueComment(user=NamedUser(login="stuglaser"), id=20227753)',
)
self.assertEqual(
self.comment.reactions,
{
"+1": 1,
"-1": 0,
"confused": 0,
"eyes": 0,
"heart": 0,
"hooray": 1,
"laugh": 0,
"rocket": 0,
"total_count": 2,
"url": "https://api.github.com/repos/PyGithub/PyGithub/issues/comments/20227753/reactions",
},
)

def testEdit(self):
Expand Down
30 changes: 9 additions & 21 deletions tests/ReplayData/IssueComment.setUp.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/ReplayData/IssueComment.testCreateReaction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
POST
api.github.com
None
/repos/jacquev6/PyGithub/issues/comments/5808311/reactions
/repos/PyGithub/PyGithub/issues/comments/20227753/reactions
{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'Accept': 'application/vnd.github.squirrel-girl-preview', 'User-Agent': 'PyGithub/Python'}
{"content": "hooray"}
201
Expand Down
2 changes: 1 addition & 1 deletion tests/ReplayData/IssueComment.testDelete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
DELETE
api.github.com
None
/repos/jacquev6/PyGithub/issues/comments/5808311
/repos/PyGithub/PyGithub/issues/comments/20227753
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
2 changes: 1 addition & 1 deletion tests/ReplayData/IssueComment.testDeleteReaction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
DELETE
api.github.com
None
/repos/jacquev6/PyGithub/issues/comments/5808311/reactions/85743754
/repos/PyGithub/PyGithub/issues/comments/20227753/reactions/85743754
{'Accept': 'application/vnd.github.squirrel-girl-preview', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
None
204
Expand Down
2 changes: 1 addition & 1 deletion tests/ReplayData/IssueComment.testEdit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
PATCH
api.github.com
None
/repos/jacquev6/PyGithub/issues/comments/5808311
/repos/PyGithub/PyGithub/issues/comments/20227753
{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
{"body": "Comment edited by PyGithub"}
200
Expand Down
2 changes: 1 addition & 1 deletion tests/ReplayData/IssueComment.testGetReactions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ https
GET
api.github.com
None
/repos/jacquev6/PyGithub/issues/comments/5808311/reactions
/repos/PyGithub/PyGithub/issues/comments/20227753/reactions
{'Authorization': 'Basic login_and_password_removed', 'Accept': 'application/vnd.github.squirrel-girl-preview', 'User-Agent': 'PyGithub/Python'}
None
200
Expand Down

0 comments on commit 8afb56b

Please sign in to comment.