Test failures

Requests fails 2 tests with all versions of Python (2.6, 2.7, 3.1, 3.2, 3.3).
This bug occurs in Requests 2.0.0 and trunk.
These tests do not exist in Requests 1.2.3.

Result for Requests trunk:

```
$ python2.7 test_requests.py
..EE..................................................................................
======================================================================
ERROR: test_DIGEST_AUTH_RETURNS_COOKIE (__main__.RequestsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_requests.py", line 285, in test_DIGEST_AUTH_RETURNS_COOKIE
    assert r.cookies['fake'] == 'fake_value'
  File "/tmp/requests/requests/cookies.py", line 256, in __getitem__
    return self._find_no_duplicates(name)
  File "/tmp/requests/requests/cookies.py", line 311, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='fake', domain=None, path=None"

======================================================================
ERROR: test_DIGEST_AUTH_SETS_SESSION_COOKIES (__main__.RequestsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_requests.py", line 295, in test_DIGEST_AUTH_SETS_SESSION_COOKIES
    assert s.cookies['fake'] == 'fake_value'
  File "/tmp/requests/requests/cookies.py", line 256, in __getitem__
    return self._find_no_duplicates(name)
  File "/tmp/requests/requests/cookies.py", line 311, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name='fake', domain=None, path=None"

----------------------------------------------------------------------
Ran 86 tests in 26.973s

FAILED (errors=2)
```


Thanks for raising this!

We've known about these test failures for a while. They're actually upstream of us: Kenneth hasn't gotten around to pushing a new version of httpbin, which has an endpoint these tests rely on. We're expecting them to pass once he does. =)


In fact if you run httpbin locally and point the tests at it, they will pass. :grinning: 


@Lukasa, I'm having similar issue right now:

```
  File "/Library/Python/2.7/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 327, in request
    self.cookies = cookiejar_from_dict(cookies, cookiejar=self.cookies, overwrite=False)
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 410, in cookiejar_from_dict
    cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 256, in __getitem__
    return self._find_no_duplicates(name)
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 311, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
```

and this started to happen after 2.0.1 upgrade.


@dmakhno Really? Mine pass fine from 2.0.1. Can I see your full testing output?


sorry I was not clear enough.
this is not tests, this is library usage, here is more full

```
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/Library/Python/2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/Library/Python/2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/Library/Python/2.7/site-packages/nose/util.py", line 469, in try_run
    return func()

  ... (my code trace goes here) it calls:
    resp = requests.get(url, cookies=self.context.cookies, verify=False)

  File "/Library/Python/2.7/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 327, in request
    self.cookies = cookiejar_from_dict(cookies, cookiejar=self.cookies, overwrite=False)
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 410, in cookiejar_from_dict
    cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 256, in __getitem__
    return self._find_no_duplicates(name)
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 311, in _find_no_duplicates
    raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name=Cookie(version=0, name='PLAY_SESSION', value='something', port=None, port_specified=False, domain='mydomain.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=True, expires=None, discard=True, comment=None, comment_url=None, rest={'HTTPOnly': None}, rfc2109=False), domain=None, path=None"
```

I rolled back to 2.0.0 and same code works fine.


Looks like the change where @daftshady wasn't expecting to be receiving CookieJar objects instead of dictionaries. There's a fix for this somewhere and should be in 2.0.2 then again, I can't be certain without confirmation from @dmakhno as to what `self.context.cookies` actually is.


We use cookies like this:

```
def authenticate(self):
        url = 'http://site.com/signIn'
        data = { 'email': 'user', 'password': 'password'}
        rsession = requests.Session()
        rsession.post(url=url, data=data, verify=False)
        self.context.cookies = rsession.cookies
        rsession.close()


authenticate()
url = 'http://site.com/organizations.json'
resp = requests.get(url, cookies=self.context.cookies, verify=False)
```

^^^ here comes error provided by dmakhno^^^


Why aren't you just continuing to use the `Session`?


I think it seems to be fault of my commit as @sigmavirus24 said.
I already attached pull request for that issue in #1713.
That will be fixed in 2.0.2 by merging my pull request or some better way to fix it.
Sorry for the inconvenience.