def test_downloadCookies(self):
"""
The C{cookies} dict passed to the L{client.HTTPDownloader}
initializer is used to populate the I{Cookie} header included in the
request sent to the server.
"""
output = self.mktemp()
factory = client._makeGetterFactory(
self.getURL('cookiemirror'),
client.HTTPDownloader,
fileOrName=output,
cookies={b'foo': b'bar'})
def cbFinished(ignored):
self.assertEqual(
FilePath(output).getContent(),
b"[('foo', 'bar')]")
factory.deferred.addCallback(cbFinished)
return factory.deferred
评论列表
文章目录