|
15 | 15 | import webcompat
|
16 | 16 |
|
17 | 17 | from webcompat.issues import filter_new
|
18 |
| -from webcompat.helpers import format_link_header |
19 |
| -from webcompat.helpers import parse_link_header |
20 |
| -from webcompat.helpers import rewrite_links |
21 |
| -from webcompat.helpers import sanitize_link |
22 | 18 |
|
23 | 19 | # Any request that depends on parsing HTTP Headers (basically anything
|
24 | 20 | # on the index route, will need to include the following: environ_base=headers
|
@@ -109,29 +105,6 @@ def test_issues_new(self):
|
109 | 105 | result = '[{"labels": [{"name": "bug"}, {"name": "help wanted"}], "id": 0, "title": "fake bug 0"}, {"labels": [], "id": 1, "title": "fake bug 1"}]'
|
110 | 106 | self.assertEqual(filter_new(issues), result)
|
111 | 107 |
|
112 |
| - def test_parse_http_link_headers(self): |
113 |
| - '''Test HTTP Links parsing for GitHub only.''' |
114 |
| - 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'}] |
115 |
| - link_header = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
116 |
| - self.assertEqual(parse_link_header(link_header), parsed_headers) |
117 |
| - |
118 |
| - def test_format_http_link_headers(self): |
119 |
| - '''Test HTTP Links formating.''' |
120 |
| - 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'}] |
121 |
| - link_header = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
122 |
| - self.assertEqual(format_link_header(parsed_headers), link_header) |
123 |
| - |
124 |
| - def test_rewrite_links(self): |
125 |
| - '''Test the rewriting is correct.''' |
126 |
| - link_header_1 = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
127 |
| - rewritten_header_1 = '</api/issues?page=2>; rel="next", </api/issues?page=11>; rel="last"' |
128 |
| - self.assertEqual(rewrite_links(link_header_1), rewritten_header_1) |
129 |
| - |
130 |
| - def test_sanitize_link(self): |
131 |
| - '''Test the sanitization.''' |
132 |
| - link_header = '<https://api.github.com/repositories/17914657/issues?page=2&access_token=abc123>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11&access_token=abc123>; rel="last"' |
133 |
| - rewritten_header = '<https://api.github.com/repositories/17914657/issues?page=2>; rel="next", <https://api.github.com/repositories/17914657/issues?page=11>; rel="last"' |
134 |
| - self.assertEqual(sanitize_link(link_header), rewritten_header) |
135 | 108 |
|
136 | 109 | if __name__ == '__main__':
|
137 | 110 | unittest.main()
|
0 commit comments