'Check that the cross-domain CSRF cookie was sent.'

def _assert_cookie_sent(self, response, is_set):

    if is_set:
        self.assertIn(self.COOKIE_NAME, response.cookies)
        cookie_header = str(response.cookies[self.COOKIE_NAME])
        expected = 'Set-Cookie:    {name}={value};    Domain={domain};'.format(name=self.COOKIE_NAME, value=self.COOKIE_VALUE, domain=self.COOKIE_DOMAIN)
        self.assertIn(expected, cookie_header)
        self.assertIn('Max-Age=31449600;    Path=/;    secure', cookie_header)
    else:
        self.assertNotIn(self.COOKIE_NAME, response.cookies)
