~ubuntu-branches/ubuntu/quantal/glance/quantal-updates

« back to all changes in this revision

Viewing changes to glance/tests/functional/v2/test_images.py

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-11-09 06:53:44 UTC
  • Revision ID: package-import@ubuntu.com-20121109065344-qtqcevhk2hm43lvv
Tags: 2012.2-0ubuntu2.3
* SECURITY UPDATE: deletion of arbitrary public and shared images via
  authenticated user
  - debian/patches/CVE-2012-4573b.patch: previous patch was incomplete.
    Make corresponding change to glance/api/v2/images.py
  - CVE-2012-4573
* debian/control: add Build-Depends-Indep on python-chardet. This is needed
  by python-requests to do encoding detection which otherwise fails in the
  new tests introduced in CVE-2012-4573b.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
        self.assertEqual(201, response.status_code)
223
223
        image_id = json.loads(response.text)['id']
224
224
 
 
225
        # Upload some image data
 
226
        path = self._url('/v2/images/%s/file' % image_id)
 
227
        headers = self._headers({'Content-Type': 'application/octet-stream'})
 
228
        response = requests.put(path, headers=headers, data='ZZZZZ')
 
229
        self.assertEqual(201, response.status_code)
 
230
 
225
231
        # TENANT1 should see the image in their list
226
232
        path = self._url('/v2/images')
227
233
        response = requests.get(path, headers=self._headers())
304
310
        response = requests.delete(path, headers=headers)
305
311
        self.assertEqual(404, response.status_code)
306
312
 
 
313
        # Image data should still be present after the failed delete
 
314
        path = self._url('/v2/images/%s/file' % image_id)
 
315
        response = requests.get(path, headers=self._headers())
 
316
        self.assertEqual(200, response.status_code)
 
317
        self.assertEqual(response.text, 'ZZZZZ')
 
318
 
307
319
        self.stop_servers()
308
320
 
309
321
    def test_tag_lifecycle(self):