8000 Initial commit for test_notifications.py · pythonthings/github3.py@bc95a2c · GitHub
[go: up one dir, main page]

Skip to content

Commit bc95a2c

Browse files
Initial commit for test_notifications.py
1 parent 7fda4c6 commit bc95a2c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/unit/test_notifications.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import github3
2+
import datetime
3+
4+
from .helper import (UnitHelper, create_example_data_helper, create_url_helper)
5+
6+
get_notification_example_data = create_example_data_helper('notification_example')
7+
url_for = create_url_helper(
8+
'https://api.github.com/notifications/threads/6169361'
9+
)
10+
11+
12+
class TestThread(UnitHelper):
13+
"""Notification unit tests."""
14+
15+
described_class = github3.notifications.Thread
16+
example_data = get_notification_example_data()
17+
18+
def test_last_read_at(self):
19+
json = self.instance.as_dict().copy()
20+
json['last_read_at'] = '2013-12-31T23:59:59Z'
21+
thread = github3.notifications.Thread(json)
22+
assert isinstance(thread.last_read_at, datetime.datetime)
23+
24+
def test_repr(self):
25+
assert repr(self.instance) == '<Thread [{0}]>'.format(
26+
self.instance.subject.get('title'))
27+
28+
def test_delete_description(self):
29+
self.instance.delete_subscription()
30+
31+
self.session.delete.assert_called_once_with(url_for('subscription'))

0 commit comments

Comments
 (0)
0