def test_storage_delete(self, mock_session): fake_storage = models.Storage() mock_session.return_value.__enter__.return_value.query.return_value \ = fake_storage result = db_api.storage_delete(ctxt, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda') assert result is None
def storage_create(context, values): """Add a storage device from the values dictionary.""" if not values.get('id'): values['id'] = uuidutils.generate_uuid() storage_ref = models.Storage() storage_ref.update(values) session = get_session() with session.begin(): session.add(storage_ref) return _storage_get(context, storage_ref['id'], session=session)
def test_storage_create(self, mock_session): fake_storage = models.Storage() mock_session.return_value.__enter__.return_value.query.return_value \ = fake_storage result = db_api.storage_create(ctxt, fake_storage) assert len(result) == 0