'L{CookieAgent.request} inserts a C{\'Cookie\'} header into the L{Request}
object when there is a cookie matching the request URI in the cookie
jar.'

def test_requestWithCookie(self):

    uri = 'http://example.com:1234/foo?bar'
    cookie = 'foo=1'
    cookieJar = cookielib.CookieJar()
    self.addCookies(cookieJar, uri, [cookie])
    self.assertEqual(len(list(cookieJar)), 1)
    agent = self.buildAgentForWrapperTest(self.reactor)
    cookieAgent = client.CookieAgent(agent, cookieJar)
    cookieAgent.request('GET', uri)
    (req, res) = self.protocol.requests.pop()
    self.assertEqual(req.headers.getRawHeaders('cookie'), [cookie])
