Merge "Changing display_name to name in v2 api"
This commit is contained in:
commit
97ec985303
@ -44,7 +44,7 @@ class ViewBuilder(common.ViewBuilder):
|
|||||||
return {
|
return {
|
||||||
'volume': {
|
'volume': {
|
||||||
'id': volume['id'],
|
'id': volume['id'],
|
||||||
'display_name': volume['display_name'],
|
'name': volume['display_name'],
|
||||||
'links': self._get_links(request,
|
'links': self._get_links(request,
|
||||||
volume['id']),
|
volume['id']),
|
||||||
},
|
},
|
||||||
@ -60,7 +60,7 @@ class ViewBuilder(common.ViewBuilder):
|
|||||||
'availability_zone': volume.get('availability_zone'),
|
'availability_zone': volume.get('availability_zone'),
|
||||||
'created_at': volume.get('created_at'),
|
'created_at': volume.get('created_at'),
|
||||||
'attachments': self._get_attachments(volume),
|
'attachments': self._get_attachments(volume),
|
||||||
'display_name': volume.get('display_name'),
|
'name': volume.get('display_name'),
|
||||||
'display_description': volume.get('display_description'),
|
'display_description': volume.get('display_description'),
|
||||||
'volume_type': self._get_volume_type(volume),
|
'volume_type': self._get_volume_type(volume),
|
||||||
'snapshot_id': volume.get('snapshot_id'),
|
'snapshot_id': volume.get('snapshot_id'),
|
||||||
|
@ -50,7 +50,7 @@ def make_volume(elem):
|
|||||||
elem.set('size')
|
elem.set('size')
|
||||||
elem.set('availability_zone')
|
elem.set('availability_zone')
|
||||||
elem.set('created_at')
|
elem.set('created_at')
|
||||||
elem.set('display_name')
|
elem.set('name')
|
||||||
elem.set('display_description')
|
elem.set('display_description')
|
||||||
elem.set('volume_type')
|
elem.set('volume_type')
|
||||||
elem.set('snapshot_id')
|
elem.set('snapshot_id')
|
||||||
@ -96,7 +96,7 @@ class CommonDeserializer(wsgi.MetadataXMLDeserializer):
|
|||||||
volume = {}
|
volume = {}
|
||||||
volume_node = self.find_first_child_named(node, 'volume')
|
volume_node = self.find_first_child_named(node, 'volume')
|
||||||
|
|
||||||
attributes = ['display_name', 'display_description', 'size',
|
attributes = ['name', 'display_description', 'size',
|
||||||
'volume_type', 'availability_zone']
|
'volume_type', 'availability_zone']
|
||||||
for attr in attributes:
|
for attr in attributes:
|
||||||
if volume_node.getAttribute(attr):
|
if volume_node.getAttribute(attr):
|
||||||
@ -178,6 +178,11 @@ class VolumeController(wsgi.Controller):
|
|||||||
remove_invalid_options(context,
|
remove_invalid_options(context,
|
||||||
search_opts, self._get_volume_search_options())
|
search_opts, self._get_volume_search_options())
|
||||||
|
|
||||||
|
# NOTE(thingee): v2 API allows name instead of display_name
|
||||||
|
if 'name' in search_opts:
|
||||||
|
search_opts['display_name'] = search_opts['name']
|
||||||
|
del search_opts['name']
|
||||||
|
|
||||||
volumes = self.volume_api.get_all(context, search_opts=search_opts)
|
volumes = self.volume_api.get_all(context, search_opts=search_opts)
|
||||||
limited_list = common.limited(volumes, req)
|
limited_list = common.limited(volumes, req)
|
||||||
if is_detail:
|
if is_detail:
|
||||||
@ -213,6 +218,11 @@ class VolumeController(wsgi.Controller):
|
|||||||
|
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|
||||||
|
# NOTE(thingee): v2 API allows name instead of display_name
|
||||||
|
if volume.get('name'):
|
||||||
|
volume['display_name'] = volume.get('name')
|
||||||
|
del volume['name']
|
||||||
|
|
||||||
req_volume_type = volume.get('volume_type', None)
|
req_volume_type = volume.get('volume_type', None)
|
||||||
if req_volume_type:
|
if req_volume_type:
|
||||||
try:
|
try:
|
||||||
@ -265,7 +275,7 @@ class VolumeController(wsgi.Controller):
|
|||||||
|
|
||||||
def _get_volume_search_options(self):
|
def _get_volume_search_options(self):
|
||||||
"""Return volume search options allowed by non-admin."""
|
"""Return volume search options allowed by non-admin."""
|
||||||
return ('display_name', 'status')
|
return ('name', 'status')
|
||||||
|
|
||||||
@wsgi.serializers(xml=VolumeTemplate)
|
@wsgi.serializers(xml=VolumeTemplate)
|
||||||
def update(self, req, id, body):
|
def update(self, req, id, body):
|
||||||
@ -282,7 +292,7 @@ class VolumeController(wsgi.Controller):
|
|||||||
update_dict = {}
|
update_dict = {}
|
||||||
|
|
||||||
valid_update_keys = (
|
valid_update_keys = (
|
||||||
'display_name',
|
'name',
|
||||||
'display_description',
|
'display_description',
|
||||||
'metadata',
|
'metadata',
|
||||||
)
|
)
|
||||||
@ -291,6 +301,11 @@ class VolumeController(wsgi.Controller):
|
|||||||
if key in volume:
|
if key in volume:
|
||||||
update_dict[key] = volume[key]
|
update_dict[key] = volume[key]
|
||||||
|
|
||||||
|
# NOTE(thingee): v2 API allows name instead of display_name
|
||||||
|
if 'name' in update_dict:
|
||||||
|
update_dict['display_name'] = update_dict['name']
|
||||||
|
del update_dict['name']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
volume = self.volume_api.get(context, id)
|
volume = self.volume_api.get(context, id)
|
||||||
self.volume_api.update(context, volume, update_dict)
|
self.volume_api.update(context, volume, update_dict)
|
||||||
|
@ -47,7 +47,7 @@ def stub_snapshot_get(self, context, snapshot_id):
|
|||||||
'status': 'available',
|
'status': 'available',
|
||||||
'volume_size': 100,
|
'volume_size': 100,
|
||||||
'created_at': None,
|
'created_at': None,
|
||||||
'display_name': 'Default name',
|
'name': 'Default name',
|
||||||
'display_description': 'Default description',
|
'display_description': 'Default description',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
|
|
||||||
vol = {
|
vol = {
|
||||||
"size": 100,
|
"size": 100,
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "zone1:host1"
|
"availability_zone": "zone1:host1"
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
res_dict = self.controller.create(req, body)
|
res_dict = self.controller.create(req, body)
|
||||||
expected = {
|
expected = {
|
||||||
'volume': {
|
'volume': {
|
||||||
'display_name': 'Volume Test Name',
|
'name': 'Volume Test Name',
|
||||||
'id': '1',
|
'id': '1',
|
||||||
'links': [
|
'links': [
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
|
|
||||||
vol = {
|
vol = {
|
||||||
"size": 100,
|
"size": 100,
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "zone1:host1",
|
"availability_zone": "zone1:host1",
|
||||||
"volume_type": db_vol_type['name'],
|
"volume_type": db_vol_type['name'],
|
||||||
@ -127,7 +127,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
|
|
||||||
def test_volume_creation_fails_with_bad_size(self):
|
def test_volume_creation_fails_with_bad_size(self):
|
||||||
vol = {"size": '',
|
vol = {"size": '',
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "zone1:host1"}
|
"availability_zone": "zone1:host1"}
|
||||||
body = {"volume": vol}
|
body = {"volume": vol}
|
||||||
@ -141,13 +141,13 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.stubs.Set(volume_api.API, "create", stubs.stub_volume_create)
|
self.stubs.Set(volume_api.API, "create", stubs.stub_volume_create)
|
||||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||||
vol = {"size": '1',
|
vol = {"size": '1',
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "nova",
|
"availability_zone": "nova",
|
||||||
"imageRef": 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'}
|
"imageRef": 'c905cedb-7281-47e4-8a62-f26bc5fc4c77'}
|
||||||
expected = {
|
expected = {
|
||||||
'volume': {
|
'volume': {
|
||||||
'display_name': 'Volume Test Name',
|
'name': 'Volume Test Name',
|
||||||
'id': '1',
|
'id': '1',
|
||||||
'links': [
|
'links': [
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||||
vol = {
|
vol = {
|
||||||
"size": '1',
|
"size": '1',
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "cinder",
|
"availability_zone": "cinder",
|
||||||
"imageRef": 'c905cedb-7281-47e4-8a62-f26bc5fc4c77',
|
"imageRef": 'c905cedb-7281-47e4-8a62-f26bc5fc4c77',
|
||||||
@ -190,7 +190,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||||
vol = {
|
vol = {
|
||||||
"size": '1',
|
"size": '1',
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "cinder",
|
"availability_zone": "cinder",
|
||||||
"imageRef": 1234,
|
"imageRef": 1234,
|
||||||
@ -207,7 +207,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||||
vol = {
|
vol = {
|
||||||
"size": '1',
|
"size": '1',
|
||||||
"display_name": "Volume Test Name",
|
"name": "Volume Test Name",
|
||||||
"display_description": "Volume Test Desc",
|
"display_description": "Volume Test Desc",
|
||||||
"availability_zone": "cinder",
|
"availability_zone": "cinder",
|
||||||
"imageRef": '12345'
|
"imageRef": '12345'
|
||||||
@ -222,7 +222,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
def test_volume_update(self):
|
def test_volume_update(self):
|
||||||
self.stubs.Set(volume_api.API, "update", stubs.stub_volume_update)
|
self.stubs.Set(volume_api.API, "update", stubs.stub_volume_update)
|
||||||
updates = {
|
updates = {
|
||||||
"display_name": "Updated Test Name",
|
"name": "Updated Test Name",
|
||||||
}
|
}
|
||||||
body = {"volume": updates}
|
body = {"volume": updates}
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
||||||
@ -232,7 +232,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
'status': 'fakestatus',
|
'status': 'fakestatus',
|
||||||
'display_description': 'displaydesc',
|
'display_description': 'displaydesc',
|
||||||
'availability_zone': 'fakeaz',
|
'availability_zone': 'fakeaz',
|
||||||
'display_name': 'Updated Test Name',
|
'name': 'Updated Test Name',
|
||||||
'attachments': [
|
'attachments': [
|
||||||
{
|
{
|
||||||
'id': '1',
|
'id': '1',
|
||||||
@ -273,7 +273,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
'status': 'fakestatus',
|
'status': 'fakestatus',
|
||||||
'display_description': 'displaydesc',
|
'display_description': 'displaydesc',
|
||||||
'availability_zone': 'fakeaz',
|
'availability_zone': 'fakeaz',
|
||||||
'display_name': 'displayname',
|
'name': 'displayname',
|
||||||
'attachments': [{
|
'attachments': [{
|
||||||
'id': '1',
|
'id': '1',
|
||||||
'volume_id': '1',
|
'volume_id': '1',
|
||||||
@ -308,7 +308,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
|
|
||||||
def test_update_invalid_body(self):
|
def test_update_invalid_body(self):
|
||||||
body = {
|
body = {
|
||||||
'display_name': 'missing top level volume key'
|
'name': 'missing top level volume key'
|
||||||
}
|
}
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
||||||
self.assertRaises(webob.exc.HTTPUnprocessableEntity,
|
self.assertRaises(webob.exc.HTTPUnprocessableEntity,
|
||||||
@ -318,7 +318,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
def test_update_not_found(self):
|
def test_update_not_found(self):
|
||||||
self.stubs.Set(volume_api.API, "get", stubs.stub_volume_get_notfound)
|
self.stubs.Set(volume_api.API, "get", stubs.stub_volume_get_notfound)
|
||||||
updates = {
|
updates = {
|
||||||
"display_name": "Updated Test Name",
|
"name": "Updated Test Name",
|
||||||
}
|
}
|
||||||
body = {"volume": updates}
|
body = {"volume": updates}
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
req = fakes.HTTPRequest.blank('/v2/volumes/1')
|
||||||
@ -334,7 +334,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
expected = {
|
expected = {
|
||||||
'volumes': [
|
'volumes': [
|
||||||
{
|
{
|
||||||
'display_name': 'displayname',
|
'name': 'displayname',
|
||||||
'id': '1',
|
'id': '1',
|
||||||
'links': [
|
'links': [
|
||||||
{
|
{
|
||||||
@ -362,7 +362,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
'status': 'fakestatus',
|
'status': 'fakestatus',
|
||||||
'display_description': 'displaydesc',
|
'display_description': 'displaydesc',
|
||||||
'availability_zone': 'fakeaz',
|
'availability_zone': 'fakeaz',
|
||||||
'display_name': 'displayname',
|
'name': 'displayname',
|
||||||
'attachments': [
|
'attachments': [
|
||||||
{
|
{
|
||||||
'device': '/',
|
'device': '/',
|
||||||
@ -402,17 +402,18 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.stubs.Set(db, 'volume_get_all_by_project',
|
self.stubs.Set(db, 'volume_get_all_by_project',
|
||||||
stub_volume_get_all_by_project)
|
stub_volume_get_all_by_project)
|
||||||
|
|
||||||
# no display_name filter
|
# no name filter
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes')
|
req = fakes.HTTPRequest.blank('/v2/volumes')
|
||||||
resp = self.controller.index(req)
|
resp = self.controller.index(req)
|
||||||
self.assertEqual(len(resp['volumes']), 3)
|
self.assertEqual(len(resp['volumes']), 3)
|
||||||
# filter on display_name
|
# filter on name
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes?display_name=vol2')
|
req = fakes.HTTPRequest.blank('/v2/volumes?name=vol2')
|
||||||
|
#import pdb; pdb.set_trace()
|
||||||
resp = self.controller.index(req)
|
resp = self.controller.index(req)
|
||||||
self.assertEqual(len(resp['volumes']), 1)
|
self.assertEqual(len(resp['volumes']), 1)
|
||||||
self.assertEqual(resp['volumes'][0]['display_name'], 'vol2')
|
self.assertEqual(resp['volumes'][0]['name'], 'vol2')
|
||||||
# filter no match
|
# filter no match
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes?display_name=vol4')
|
req = fakes.HTTPRequest.blank('/v2/volumes?name=vol4')
|
||||||
resp = self.controller.index(req)
|
resp = self.controller.index(req)
|
||||||
self.assertEqual(len(resp['volumes']), 0)
|
self.assertEqual(len(resp['volumes']), 0)
|
||||||
|
|
||||||
@ -442,14 +443,14 @@ class VolumeApiTest(test.TestCase):
|
|||||||
self.assertEqual(volume['status'], 'available')
|
self.assertEqual(volume['status'], 'available')
|
||||||
# multiple filters
|
# multiple filters
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes/details/?status=available&'
|
req = fakes.HTTPRequest.blank('/v2/volumes/details/?status=available&'
|
||||||
'display_name=vol1')
|
'name=vol1')
|
||||||
resp = self.controller.detail(req)
|
resp = self.controller.detail(req)
|
||||||
self.assertEqual(len(resp['volumes']), 1)
|
self.assertEqual(len(resp['volumes']), 1)
|
||||||
self.assertEqual(resp['volumes'][0]['display_name'], 'vol1')
|
self.assertEqual(resp['volumes'][0]['name'], 'vol1')
|
||||||
self.assertEqual(resp['volumes'][0]['status'], 'available')
|
self.assertEqual(resp['volumes'][0]['status'], 'available')
|
||||||
# no match
|
# no match
|
||||||
req = fakes.HTTPRequest.blank('/v2/volumes/details?status=in-use&'
|
req = fakes.HTTPRequest.blank('/v2/volumes/details?status=in-use&'
|
||||||
'display_name=vol1')
|
'name=vol1')
|
||||||
resp = self.controller.detail(req)
|
resp = self.controller.detail(req)
|
||||||
self.assertEqual(len(resp['volumes']), 0)
|
self.assertEqual(len(resp['volumes']), 0)
|
||||||
|
|
||||||
@ -461,7 +462,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
'status': 'fakestatus',
|
'status': 'fakestatus',
|
||||||
'display_description': 'displaydesc',
|
'display_description': 'displaydesc',
|
||||||
'availability_zone': 'fakeaz',
|
'availability_zone': 'fakeaz',
|
||||||
'display_name': 'displayname',
|
'name': 'displayname',
|
||||||
'attachments': [
|
'attachments': [
|
||||||
{
|
{
|
||||||
'device': '/',
|
'device': '/',
|
||||||
@ -503,7 +504,7 @@ class VolumeApiTest(test.TestCase):
|
|||||||
'status': 'fakestatus',
|
'status': 'fakestatus',
|
||||||
'display_description': 'displaydesc',
|
'display_description': 'displaydesc',
|
||||||
'availability_zone': 'fakeaz',
|
'availability_zone': 'fakeaz',
|
||||||
'display_name': 'displayname',
|
'name': 'displayname',
|
||||||
'attachments': [],
|
'attachments': [],
|
||||||
'volume_type': 'vol_type_name',
|
'volume_type': 'vol_type_name',
|
||||||
'snapshot_id': None,
|
'snapshot_id': None,
|
||||||
@ -582,7 +583,7 @@ class VolumeSerializerTest(test.TestCase):
|
|||||||
self.assertEqual(tree.tag, NS + 'volume')
|
self.assertEqual(tree.tag, NS + 'volume')
|
||||||
|
|
||||||
for attr in ('id', 'status', 'size', 'availability_zone', 'created_at',
|
for attr in ('id', 'status', 'size', 'availability_zone', 'created_at',
|
||||||
'display_name', 'display_description', 'volume_type',
|
'name', 'display_description', 'volume_type',
|
||||||
'snapshot_id'):
|
'snapshot_id'):
|
||||||
self.assertEqual(str(vol[attr]), tree.get(attr))
|
self.assertEqual(str(vol[attr]), tree.get(attr))
|
||||||
|
|
||||||
@ -618,7 +619,7 @@ class VolumeSerializerTest(test.TestCase):
|
|||||||
device='/foo'
|
device='/foo'
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
display_name='vol_name',
|
name='vol_name',
|
||||||
display_description='vol_desc',
|
display_description='vol_desc',
|
||||||
volume_type='vol_type',
|
volume_type='vol_type',
|
||||||
snapshot_id='snap_id',
|
snapshot_id='snap_id',
|
||||||
@ -651,7 +652,7 @@ class VolumeSerializerTest(test.TestCase):
|
|||||||
device='/foo1'
|
device='/foo1'
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
display_name='vol1_name',
|
name='vol1_name',
|
||||||
display_description='vol1_desc',
|
display_description='vol1_desc',
|
||||||
volume_type='vol1_type',
|
volume_type='vol1_type',
|
||||||
snapshot_id='snap1_id',
|
snapshot_id='snap1_id',
|
||||||
@ -667,7 +668,7 @@ class VolumeSerializerTest(test.TestCase):
|
|||||||
volume_id='vol2_id',
|
volume_id='vol2_id',
|
||||||
server_id='instance_uuid',
|
server_id='instance_uuid',
|
||||||
device='/foo2')],
|
device='/foo2')],
|
||||||
display_name='vol2_name',
|
name='vol2_name',
|
||||||
display_description='vol2_desc',
|
display_description='vol2_desc',
|
||||||
volume_type='vol2_type',
|
volume_type='vol2_type',
|
||||||
snapshot_id='snap2_id',
|
snapshot_id='snap2_id',
|
||||||
@ -702,16 +703,16 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
}
|
}
|
||||||
self.assertEquals(request['body'], expected)
|
self.assertEquals(request['body'], expected)
|
||||||
|
|
||||||
def test_display_name(self):
|
def test_name(self):
|
||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
size="1"
|
size="1"
|
||||||
display_name="Volume-xml"></volume>"""
|
name="Volume-xml"></volume>"""
|
||||||
request = self.deserializer.deserialize(self_request)
|
request = self.deserializer.deserialize(self_request)
|
||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
self.assertEquals(request['body'], expected)
|
self.assertEquals(request['body'], expected)
|
||||||
@ -720,13 +721,13 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
size="1"
|
size="1"
|
||||||
display_name="Volume-xml"
|
name="Volume-xml"
|
||||||
display_description="description"></volume>"""
|
display_description="description"></volume>"""
|
||||||
request = self.deserializer.deserialize(self_request)
|
request = self.deserializer.deserialize(self_request)
|
||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"display_description": "description",
|
"display_description": "description",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -736,15 +737,15 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
size="1"
|
size="1"
|
||||||
display_name="Volume-xml"
|
name="Volume-xml"
|
||||||
display_description="description"
|
display_description="description"
|
||||||
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"></volume>"""
|
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"></volume>"""
|
||||||
request = self.deserializer.deserialize(self_request)
|
request = self.deserializer.deserialize(self_request)
|
||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"display_description": "description",
|
"display_description": "description",
|
||||||
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
||||||
},
|
},
|
||||||
@ -755,7 +756,7 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
size="1"
|
size="1"
|
||||||
display_name="Volume-xml"
|
name="Volume-xml"
|
||||||
display_description="description"
|
display_description="description"
|
||||||
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"
|
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"
|
||||||
availability_zone="us-east1"></volume>"""
|
availability_zone="us-east1"></volume>"""
|
||||||
@ -763,7 +764,7 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"display_description": "description",
|
"display_description": "description",
|
||||||
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
||||||
"availability_zone": "us-east1",
|
"availability_zone": "us-east1",
|
||||||
@ -774,13 +775,13 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
def test_metadata(self):
|
def test_metadata(self):
|
||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
display_name="Volume-xml"
|
name="Volume-xml"
|
||||||
size="1">
|
size="1">
|
||||||
<metadata><meta key="Type">work</meta></metadata></volume>"""
|
<metadata><meta key="Type">work</meta></metadata></volume>"""
|
||||||
request = self.deserializer.deserialize(self_request)
|
request = self.deserializer.deserialize(self_request)
|
||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"Type": "work",
|
"Type": "work",
|
||||||
@ -793,7 +794,7 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
self_request = """
|
self_request = """
|
||||||
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
<volume xmlns="http://docs.openstack.org/api/openstack-volume/2.0/content"
|
||||||
size="1"
|
size="1"
|
||||||
display_name="Volume-xml"
|
name="Volume-xml"
|
||||||
display_description="description"
|
display_description="description"
|
||||||
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"
|
volume_type="289da7f8-6440-407c-9fb4-7db01ec49164"
|
||||||
availability_zone="us-east1">
|
availability_zone="us-east1">
|
||||||
@ -802,7 +803,7 @@ class TestVolumeCreateRequestXMLDeserializer(test.TestCase):
|
|||||||
expected = {
|
expected = {
|
||||||
"volume": {
|
"volume": {
|
||||||
"size": "1",
|
"size": "1",
|
||||||
"display_name": "Volume-xml",
|
"name": "Volume-xml",
|
||||||
"display_description": "description",
|
"display_description": "description",
|
||||||
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
"volume_type": "289da7f8-6440-407c-9fb4-7db01ec49164",
|
||||||
"availability_zone": "us-east1",
|
"availability_zone": "us-east1",
|
||||||
|
Loading…
Reference in New Issue
Block a user