Pylons/webtest — pull request #55 by kedder (2013-03-07 14:31:44+00:00)
Title: Support secure cookies

When I try to call application using webtest and have secure cookies in cookiejar, I'm getting the following exception:

```
File "", line 1, in
browser.open('https://dev.example.org/get_cookie.html')
File "/home/andrey/projects/zope/zope.testbrowser/src/zope/testbrowser/browser2.py", line 138, in open
self._response = self.testapp.get(url, **reqargs)
File "/home/andrey/.buildout/eggs/WebTest-2.0.1-py2.7.egg/webtest/app.py", line 199, in get
expect_errors=expect_errors)
File "/home/andrey/.buildout/eggs/WebTest-2.0.1-py2.7.egg/webtest/app.py", line 461, in do_request
self.cookiejar.add_cookie_header(utils._RequestCookieAdapter(req))
File "/usr/lib/python2.7/cookielib.py", line 1324, in add_cookie_header
cookies = self._cookies_for_request(request)
File "/usr/lib/python2.7/cookielib.py", line 1250, in _cookies_for_request
cookies.extend(self._cookies_for_domain(domain, request))
File "/usr/lib/python2.7/cookielib.py", line 1239, in _cookies_for_domain
if not self._policy.return_ok(cookie, request):
File "/usr/lib/python2.7/cookielib.py", line 1071, in return_ok
if not fn(cookie, request):
File "/usr/lib/python2.7/cookielib.py", line 1097, in return_ok_secure
if cookie.secure and request.get_type() != "https":
AttributeError: '_RequestCookieAdapter' object has no attribute 'get_type'
```

This is due to incomplete urllib2.Request interface implementation by _RequestCookieAdapter, specified at http://docs.python.org/2/library/cookielib.html#cookielib.CookieJar.add_cookie_header.

The commit fixes the problem and adds a regression test.

Please pull.