From: Roman Haritonov Date: Tue, 8 May 2012 08:55:36 +0000 (+0400) Subject: Test async requests with Session cookies X-Git-Tag: v0.13.0~29^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=975430d5e622b9815e42963c3c0b0704e7d5a39c;p=services%2Fpython-requests.git Test async requests with Session cookies --- diff --git a/tests/test_requests_async.py b/tests/test_requests_async.py index 3a5a762..892472c 100755 --- a/tests/test_requests_async.py +++ b/tests/test_requests_async.py @@ -12,6 +12,7 @@ import select has_poll = hasattr(select, "poll") from requests import async +import requests sys.path.append('.') from test_requests import httpbin, RequestsTestSuite, SERVICES @@ -63,5 +64,14 @@ class RequestsTestSuiteUsingAsyncApi(RequestsTestSuite): """Test to make sure we don't overwrite the poll""" self.assertEqual(hasattr(select, "poll"), has_poll) + def test_async_with_session_cookies(self): + s = requests.Session(cookies={'initial': '42'}) + r1 = get(httpbin('cookies/set/async/yes'), session=s) + r2 = get(httpbin('cookies/set/no_session/yes')) + assert 'initial' in r1.cookies + assert 'initial' not in r2.cookies and 'async' not in r2.cookies + assert 'async' in s.cookies + assert 'no_session' not in s.cookies + if __name__ == '__main__': unittest.main()