def testCookieAuth(self):
    "\n        We make sure a cookie is sufficient for authentication for the item\n        download endpoint. Also, while we're at it, we make sure it's not\n        sufficient for other endpoints.\n        "
    item = self._createItem(self.privateFolder['_id'], 'cookie_auth_download', '', self.users[0])
    self._testUploadFileToItem(item, 'file', self.users[0], 'foo')
    token = Token().createToken(self.users[0])
    cookie = ('girderToken=%s' % token['_id'])
    resp = self.request(path=('/item/%s/download' % item['_id']), isJson=False, cookie=cookie)
    self.assertStatusOk(resp)
    self.assertEqual(self.getBody(resp), 'foo')
    resp = self.request(path=('/item/%s' % item['_id']), cookie=cookie)
    self.assertStatus(resp, 401)
    resp = self.request(path=('/item/%s/download' % item['_id']), cookie='girderToken=invalid_token')
    self.assertStatus(resp, 401)
We make sure a cookie is sufficient for authentication for the item
download endpoint. Also, while we're at it, we make sure it's not
sufficient for other endpoints.
def testCookieAuth(self):
    "\n        We make sure a cookie is sufficient for authentication for the item\n        download endpoint. Also, while we're at it, we make sure it's not\n        sufficient for other endpoints.\n        "
    item = self._createItem(self.privateFolder['_id'], 'cookie_auth_download', , self.users[0])
    self._testUploadFileToItem(item, 'file', self.users[0], 'foo')
    token = Token().createToken(self.users[0])
    cookie = ('girderToken=%s' % token['_id'])
    resp = self.request(path=('/item/%s/download' % item['_id']), isJson=False, cookie=cookie)
    self.assertStatusOk(resp)
    self.assertEqual(self.getBody(resp), 'foo')
    resp = self.request(path=('/item/%s' % item['_id']), cookie=cookie)
    self.assertStatus(resp, 401)
    resp = self.request(path=('/item/%s/download' % item['_id']), cookie='girderToken=invalid_token')
    self.assertStatus(resp, 401)