def setUp(self): super(SnapshotMetaDataTest, self).setUp() self.volume_api = cinder.volume.api.API() self.stubs.Set(volume.api.API, 'get', stub_get) self.stubs.Set(cinder.db, 'snapshot_get', return_snapshot) self.stubs.Set(self.volume_api, 'update_snapshot_metadata', fake_update_snapshot_metadata) self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.snapshot_controller = snapshots.SnapshotsController(self.ext_mgr) self.controller = snapshot_metadata.Controller() self.url = '/v1/%s/snapshots/%s/metadata' % (fake.project_id, fake.snapshot_id) snap = { "volume_size": 100, "volume_id": fake.volume_id, "display_name": "Snapshot Test Name", "display_description": "Snapshot Test Desc", "availability_zone": "zone1:host1", "host": "fake-host", "metadata": {} } body = {"snapshot": snap} req = fakes.HTTPRequest.blank('/v1/snapshots') self.snapshot_controller.create(req, body)
def setUp(self): super(SnapshotMetaDataTest, self).setUp() self.volume_api = cinder.volume.api.API() fakes.stub_out_key_pair_funcs(self.stubs) self.stubs.Set(cinder.db, 'volume_get', return_volume) self.stubs.Set(cinder.db, 'snapshot_get', return_snapshot) self.stubs.Set(cinder.db, 'snapshot_metadata_get', return_snapshot_metadata) self.stubs.Set(self.volume_api, 'update_snapshot_metadata', fake_update_snapshot_metadata) self.ext_mgr = extensions.ExtensionManager() self.ext_mgr.extensions = {} self.snapshot_controller = snapshots.SnapshotsController(self.ext_mgr) self.controller = snapshot_metadata.Controller() self.req_id = str(uuid.uuid4()) self.url = '/v1/fake/snapshots/%s/metadata' % self.req_id snap = { "volume_size": 100, "volume_id": "fake-vol-id", "display_name": "Volume Test Name", "display_description": "Volume Test Desc", "availability_zone": "zone1:host1", "host": "fake-host", "metadata": {} } body = {"snapshot": snap} req = fakes.HTTPRequest.blank('/v1/snapshots') self.snapshot_controller.create(req, body)
def setUp(self): super(SnapshotApiTest, self).setUp() self.controller = snapshots.SnapshotsController() self.stubs.Set(db, 'snapshot_get_all_by_project', stubs.stub_snapshot_get_all_by_project) self.stubs.Set(db, 'snapshot_get_all', stubs.stub_snapshot_get_all)
def setUp(self): super(SnapshotsUnprocessableEntityTestCase, self).setUp() self.controller = snapshots.SnapshotsController()
def setUp(self): super(SnapshotApiTest, self).setUp() self.controller = snapshots.SnapshotsController() self.ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)