-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
23 lines (19 loc) · 870 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import unittest
import links_from_header
class ExtractTestCase(unittest.TestCase):
def test_github_header(self):
header = ('<https://api.github.com/user/repos?page=1>; rel="first", ' +
'<https://api.github.com/user/repos?page=9>; rel="prev", ' +
'<https://api.github.com/user/repos?page=11>; rel="next", ' +
'<https://api.github.com/user/repos?page=50>; rel="last"')
self.assertEqual(
links_from_header.extract(header),
{
'first': 'https://api.github.com/user/repos?page=1',
'prev': 'https://api.github.com/user/repos?page=9',
'next': 'https://api.github.com/user/repos?page=11',
'last': 'https://api.github.com/user/repos?page=50',
}
)
if __name__ == '__main__':
unittest.main()