~jaypipes/glance/bug704038

« back to all changes in this revision

Viewing changes to tests/stubs.py

  • Committer: Tarmac
  • Author(s): Rick Harris
  • Date: 2011-01-12 16:31:29 UTC
  • mfrom: (32.1.7 deferred_data)
  • Revision ID: tarmac-20110112163129-y8wyezl0ksh680bk
This merge is in conjunction with lp:~rconradharris/nova/xs-snap-return-image-id-before-snapshot

The patch does the following:

  * Image Create (POST) is broken up into 3 steps (reserve, upload and activate); reserve is used to allow the OpenStack API to return metadata about an image where the data has not been uploaded yet
  * Image Update (PUT) now takes image data as the request body and metadata as headers (just like POST); state is enforced so that image data can only be uploaded once.
  * Image statuses were changed to match the OpenStack API (queued, saving, active, killed); NOTE: preparing is not used
  * update_image and add_image client calls now return metadata instead of just the id

Show diffs side-by-side

added added

removed removed

Lines of Context:
279
279
        FIXTURES = [
280
280
            {'id': 1,
281
281
                'name': 'fake image #1',
282
 
                'status': 'available',
 
282
                'status': 'active',
283
283
                'type': 'kernel',
284
284
                'is_public': False,
285
285
                'created_at': datetime.datetime.utcnow(),
291
291
                'properties': []},
292
292
            {'id': 2,
293
293
                'name': 'fake image #2',
294
 
                'status': 'available',
 
294
                'status': 'active',
295
295
                'type': 'kernel',
296
296
                'is_public': True,
297
297
                'created_at': datetime.datetime.utcnow(),
302
302
                'location': "file:///tmp/glance-tests/2",
303
303
                'properties': []}]
304
304
 
305
 
        VALID_STATUSES = ('available', 'disabled', 'pending')
 
305
        VALID_STATUSES = ('active', 'killed', 'queued', 'saving')
306
306
 
307
307
        def __init__(self):
308
308
            self.images = FakeDatastore.FIXTURES
317
317
                                          values['id'])
318
318
 
319
319
            if 'status' not in values.keys():
320
 
                values['status'] = 'available'
 
320
                values['status'] = 'active'
321
321
            else:
322
322
                if not values['status'] in self.VALID_STATUSES:
323
323
                    raise exception.Invalid("Invalid status '%s' for image" %