-
Notifications
You must be signed in to change notification settings - Fork 406
/
Copy pathtest_notifications.py
42 lines (34 loc) · 1.54 KB
/
test_notifications.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Integration test for Notifications."""
import github3
from .helper import IntegrationHelper
class TestThread(IntegrationHelper):
"""Integration test for methods on Test class."""
def test_subscription(self):
"""Show that a user can retrieve notifications for repository."""
self.token_login()
cassette_name = self.cassette_name("subscription")
with self.recorder.use_cassette(cassette_name):
repository = self.gh.repository("sigmavirus24", "github3.py")
threads = list(repository.notifications(all=True))
assert len(threads) > 0
thread = threads[0]
assert isinstance(thread, github3.notifications.Thread)
assert isinstance(
thread.subscription(),
github3.notifications.ThreadSubscription,
)
class TestThreadSubscription(IntegrationHelper):
"""Integration test for methods on Test class."""
def test_set(self):
"""Show that user can successful set subscription."""
self.token_login()
cassette_name = self.cassette_name("set")
with self.recorder.use_cassette(cassette_name):
repository = self.gh.repository("sigmavirus24", "github3.py")
threads = list(repository.notifications(all="true"))
assert len(threads) > 0
subscription = threads[0].subscription()
assert subscription.set(True, False) is None
assert isinstance(
subscription, github3.notifications.ThreadSubscription
)