Mark notification as read (#932)

Wraps the parts of the notification API that allows the user to mark notifications as read.
New methods are : 
 
- Notification.mark_as_read : marks a single notification thread as read
- Repository.mark_notifications_as_read : marks all the notifications for a given repository as read
- AuthenticatedUser.mark_notifications_as_read : marks all the notifications as read

Aims to fix : https://github.com/PyGithub/PyGithub/issues/571 and simply uses the APIs described on this page : https://developer.github.com/enterprise/11.10.340/v3/activity/notifications/

A weird thing I noticed doing this is that Repository.notifications_url doesn't seem to be usable directly. I used Repository.url + "/notifications" instead.
This commit is contained in:
Alice GIRARD
2018-10-19 07:24:45 +08:00
committed by Wan Liuyang
parent 2b2ecfad4d
commit 0a10d7cdf0
12 changed files with 166 additions and 0 deletions
+4
View File
@@ -500,6 +500,10 @@ class Repository(Framework.TestCase):
self.assertListKeyEqual(issues[0].labels, lambda l: l.name, ["Functionalities", "RequestedByUser"])
self.assertEqual(issues[0].state, "open")
def testMarkNotificationsAsRead(self):
repo = self.g.get_user().get_repo("PyGithub")
repo.mark_notifications_as_read(datetime.datetime(2018, 10, 18, 18, 19, 43, 0))
def testAssignees(self):
lyloa = self.g.get_user("Lyloa")
jacquev6 = self.g.get_user("jacquev6")