|
28 | 28 | GITHUB_SEARCH_LINK_HEADER = '<https://api.github.com/search/issues?q=taco&page=2>; rel="next", <https://api.github.com/search/issues?q=taco&page=26>; rel="last"'
|
29 | 29 | REWRITTEN_ISSUES_LINK_HEADER = '</api/issues?per_page=50&page=3>; rel="next", </api/issues?per_page=50&page=4>; rel="last", </api/issues?per_page=50&page=1>; rel="first", </api/issues?per_page=50&page=1>; rel="prev"'
|
30 | 30 | REWRITTEN_SEARCH_LINK_HEADER = '</api/issues/search?q=taco&page=2>; rel="next", </api/issues/search?q=taco&page=26>; rel="last"'
|
| 31 | +PARSED_LINKED_HEADERS = [{'link': 'https://api.github.com/repositories/17839063/issues?per_page=50&page=3', 'rel': 'next'}, {'link': 'https://api.github.com/repositories/17839063/issues?per_page=50&page=4', 'rel': 'last'}, {'link': 'https://api.github.com/repositories/17839063/issues?per_page=50&page=1', 'rel': 'first'}, {'link': 'https://api.github.com/repositories/17839063/issues?per_page=50&page=1', 'rel': 'prev'}] |
31 | 32 |
|
32 | 33 |
|
33 | 34 | class TestHelpers(unittest.TestCase):
|
@@ -99,14 +100,14 @@ def test_normalize_api_params_ignores_unknown_params(self):
|
99 | 100 |
|
100 | 101 | def test_parse_http_link_headers(self):
|
101 | 102 | '''Test HTTP Links parsing for GitHub only.'''
|
102 |
| - parsed_headers = [{'link': 'https://api.github.com/repositories/17914657/issues?page=2', 'rel': 'next'}, {'link': 'https://api.github.com/repositories/17914657/issues?page=11', 'rel': 'last'}] |
103 |
| - link_header = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
| 103 | + link_header = GITHUB_ISSUES_LINK_HEADER |
| 104 | + parsed_headers = PARSED_LINKED_HEADERS |
104 | 105 | self.assertEqual(parse_link_header(link_header), parsed_headers)
|
105 | 106 |
|
106 | 107 | def test_format_http_link_headers(self):
|
107 | 108 | '''Test HTTP Links formating.'''
|
108 |
| - parsed_headers = [{'link': 'https://api.github.com/repositories/17914657/issues?page=2', 'rel': 'next'}, {'link': 'https://api.github.com/repositories/17914657/issues?page=11', 'rel': 'last'}] |
109 |
| - link_header = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
| 109 | + parsed_headers = PARSED_LINKED_HEADERS |
| 110 | + link_header = GITHUB_ISSUES_LINK_HEADER |
110 | 111 | self.assertEqual(format_link_header(parsed_headers), link_header)
|
111 | 112 |
|
112 | 113 | if __name__ == '__main__':
|
|
0 commit comments