'Call L{http.Request.setCookie} with C{*args} and C{**kwargs}, and check
that the cookie value is equal to C{expectedCookieValue}.'

def _checkCookie(self, expectedCookieValue, *args, **kwargs):

    channel = DummyChannel()
    req = http.Request(channel, False)
    req.addCookie(*args, **kwargs)
    self.assertEqual(req.cookies[0], expectedCookieValue)
    req.write('')
    writtenLines = channel.transport.written.getvalue().split('\r\n')
    setCookieLines = [x for x in writtenLines if x.startswith('Set-Cookie')]
    self.assertEqual(len(setCookieLines), 1)
    self.assertEqual(setCookieLines[0], ('Set-Cookie:    ' + expectedCookieValue))
