From: Ian Cordasco Date: Sat, 26 Jan 2013 16:55:08 +0000 (-0500) Subject: Mock the links test. X-Git-Tag: v1.2.0~63^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=250896b7f3a049843dc976f9e466f90e145108cc;p=services%2Fpython-requests.git Mock the links test. --- diff --git a/test_requests.py b/test_requests.py index ac632d3..6a4409b 100644 --- a/test_requests.py +++ b/test_requests.py @@ -282,8 +282,27 @@ class RequestsTestCase(unittest.TestCase): self.assertTrue(hasattr(resp, 'hook_working')) def test_links(self): - url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10' - r = requests.head(url=url) + r = requests.Response() + r.headers = { + 'cache-control': 'public, max-age=60, s-maxage=60', + 'connection': 'keep-alive', + 'content-encoding': 'gzip', + 'content-type': 'application/json; charset=utf-8', + 'date': 'Sat, 26 Jan 2013 16:47:56 GMT', + 'etag': '"6ff6a73c0e446c1f61614769e3ceb778"', + 'last-modified': 'Sat, 26 Jan 2013 16:22:39 GMT', + 'link': ('; rel="next", ; ' + ' rel="last"'), + 'server': 'GitHub.com', + 'status': '200 OK', + 'vary': 'Accept', + 'x-content-type-options': 'nosniff', + 'x-github-media-type': 'github.beta', + 'x-ratelimit-limit': '60', + 'x-ratelimit-remaining': '57' + } self.assertEqual(r.links['next']['rel'], 'next') def test_cookie_parameters(self):