diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-03-22 14:39:52 -0700 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-03-23 09:21:10 -0700 |
| commit | 58bcbc1151c7c509054bcfdfd0e4af7b62f71e9e (patch) | |
| tree | ae4ed64f97f60f2119a4d1bc472c1c61f0b8d591 /nova/tests | |
| parent | 5c5a5fbaa03f1864b434bed47796b7b745a24442 (diff) | |
Volumes API now uses underscores for attrs
* Fixes bug 943053
Change-Id: I7066e963b4377a4a1f8a3c259e6273e6a0ca073f
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/volume/test_snapshots.py | 36 | ||||
| -rw-r--r-- | nova/tests/api/openstack/volume/test_volumes.py | 132 | ||||
| -rw-r--r-- | nova/tests/integrated/test_volumes.py | 2 |
3 files changed, 85 insertions, 85 deletions
diff --git a/nova/tests/api/openstack/volume/test_snapshots.py b/nova/tests/api/openstack/volume/test_snapshots.py index 95efc539b..663337eb1 100644 --- a/nova/tests/api/openstack/volume/test_snapshots.py +++ b/nova/tests/api/openstack/volume/test_snapshots.py @@ -90,9 +90,9 @@ class SnapshotApiTest(test.TestCase): resp_dict = self.controller.create(req, body) self.assertTrue('snapshot' in resp_dict) - self.assertEqual(resp_dict['snapshot']['displayName'], + self.assertEqual(resp_dict['snapshot']['display_name'], snapshot['display_name']) - self.assertEqual(resp_dict['snapshot']['displayDescription'], + self.assertEqual(resp_dict['snapshot']['display_description'], snapshot['display_description']) def test_snapshot_create_force(self): @@ -108,9 +108,9 @@ class SnapshotApiTest(test.TestCase): resp_dict = self.controller.create(req, body) self.assertTrue('snapshot' in resp_dict) - self.assertEqual(resp_dict['snapshot']['displayName'], + self.assertEqual(resp_dict['snapshot']['display_name'], snapshot['display_name']) - self.assertEqual(resp_dict['snapshot']['displayDescription'], + self.assertEqual(resp_dict['snapshot']['display_description'], snapshot['display_description']) def test_snapshot_delete(self): @@ -161,8 +161,8 @@ class SnapshotSerializerTest(test.TestCase): def _verify_snapshot(self, snap, tree): self.assertEqual(tree.tag, 'snapshot') - for attr in ('id', 'status', 'size', 'createdAt', - 'displayName', 'displayDescription', 'volumeId'): + for attr in ('id', 'status', 'size', 'created_at', + 'display_name', 'display_description', 'volume_id'): self.assertEqual(str(snap[attr]), tree.get(attr)) def test_snapshot_show_create_serializer(self): @@ -171,10 +171,10 @@ class SnapshotSerializerTest(test.TestCase): id='snap_id', status='snap_status', size=1024, - createdAt=datetime.datetime.now(), - displayName='snap_name', - displayDescription='snap_desc', - volumeId='vol_id', + created_at=datetime.datetime.now(), + display_name='snap_name', + display_description='snap_desc', + volume_id='vol_id', ) text = serializer.serialize(dict(snapshot=raw_snapshot)) @@ -189,19 +189,19 @@ class SnapshotSerializerTest(test.TestCase): id='snap1_id', status='snap1_status', size=1024, - createdAt=datetime.datetime.now(), - displayName='snap1_name', - displayDescription='snap1_desc', - volumeId='vol1_id', + created_at=datetime.datetime.now(), + display_name='snap1_name', + display_description='snap1_desc', + volume_id='vol1_id', ), dict( id='snap2_id', status='snap2_status', size=1024, - createdAt=datetime.datetime.now(), - displayName='snap2_name', - displayDescription='snap2_desc', - volumeId='vol2_id', + created_at=datetime.datetime.now(), + display_name='snap2_name', + display_description='snap2_desc', + volume_id='vol2_id', )] text = serializer.serialize(dict(snapshots=raw_snapshots)) diff --git a/nova/tests/api/openstack/volume/test_volumes.py b/nova/tests/api/openstack/volume/test_volumes.py index c451dde3b..7befe9606 100644 --- a/nova/tests/api/openstack/volume/test_volumes.py +++ b/nova/tests/api/openstack/volume/test_volumes.py @@ -48,18 +48,18 @@ class VolumeApiTest(test.TestCase): req = fakes.HTTPRequest.blank('/v1/volumes') res_dict = self.controller.create(req, body) expected = {'volume': {'status': 'fakestatus', - 'displayDescription': 'Volume Test Desc', - 'availabilityZone': 'zone1:host1', - 'displayName': 'Volume Test Name', + 'display_description': 'Volume Test Desc', + 'availability_zone': 'zone1:host1', + 'display_name': 'Volume Test Name', 'attachments': [{'device': '/', - 'serverId': 'fakeuuid', + 'server_id': 'fakeuuid', 'id': '1', - 'volumeId': '1'}], - 'volumeType': 'vol_type_name', - 'snapshotId': None, + 'volume_id': '1'}], + 'volume_type': 'vol_type_name', + 'snapshot_id': None, 'metadata': {}, 'id': '1', - 'createdAt': datetime.datetime(1, 1, 1, + 'created_at': datetime.datetime(1, 1, 1, 1, 1, 1), 'size': 100}} self.assertEqual(res_dict, expected) @@ -76,18 +76,18 @@ class VolumeApiTest(test.TestCase): req = fakes.HTTPRequest.blank('/v1/volumes') res_dict = self.controller.index(req) expected = {'volumes': [{'status': 'fakestatus', - 'displayDescription': 'displaydesc', - 'availabilityZone': 'fakeaz', - 'displayName': 'displayname', + 'display_description': 'displaydesc', + 'availability_zone': 'fakeaz', + 'display_name': 'displayname', 'attachments': [{'device': '/', - 'serverId': 'fakeuuid', + 'server_id': 'fakeuuid', 'id': '1', - 'volumeId': '1'}], - 'volumeType': 'vol_type_name', - 'snapshotId': None, + 'volume_id': '1'}], + 'volume_type': 'vol_type_name', + 'snapshot_id': None, 'metadata': {}, 'id': '1', - 'createdAt': datetime.datetime(1, 1, 1, + 'created_at': datetime.datetime(1, 1, 1, 1, 1, 1), 'size': 1}]} self.assertEqual(res_dict, expected) @@ -96,18 +96,18 @@ class VolumeApiTest(test.TestCase): req = fakes.HTTPRequest.blank('/v1/volumes/detail') res_dict = self.controller.index(req) expected = {'volumes': [{'status': 'fakestatus', - 'displayDescription': 'displaydesc', - 'availabilityZone': 'fakeaz', - 'displayName': 'displayname', + 'display_description': 'displaydesc', + 'availability_zone': 'fakeaz', + 'display_name': 'displayname', 'attachments': [{'device': '/', - 'serverId': 'fakeuuid', + 'server_id': 'fakeuuid', 'id': '1', - 'volumeId': '1'}], - 'volumeType': 'vol_type_name', - 'snapshotId': None, + 'volume_id': '1'}], + 'volume_type': 'vol_type_name', + 'snapshot_id': None, 'metadata': {}, 'id': '1', - 'createdAt': datetime.datetime(1, 1, 1, + 'created_at': datetime.datetime(1, 1, 1, 1, 1, 1), 'size': 1}]} self.assertEqual(res_dict, expected) @@ -116,18 +116,18 @@ class VolumeApiTest(test.TestCase): req = fakes.HTTPRequest.blank('/v1/volumes/1') res_dict = self.controller.show(req, 1) expected = {'volume': {'status': 'fakestatus', - 'displayDescription': 'displaydesc', - 'availabilityZone': 'fakeaz', - 'displayName': 'displayname', + 'display_description': 'displaydesc', + 'availability_zone': 'fakeaz', + 'display_name': 'displayname', 'attachments': [{'device': '/', - 'serverId': 'fakeuuid', + 'server_id': 'fakeuuid', 'id': '1', - 'volumeId': '1'}], - 'volumeType': 'vol_type_name', - 'snapshotId': None, + 'volume_id': '1'}], + 'volume_type': 'vol_type_name', + 'snapshot_id': None, 'metadata': {}, 'id': '1', - 'createdAt': datetime.datetime(1, 1, 1, + 'created_at': datetime.datetime(1, 1, 1, 1, 1, 1), 'size': 1}} self.assertEqual(res_dict, expected) @@ -141,15 +141,15 @@ class VolumeApiTest(test.TestCase): req = fakes.HTTPRequest.blank('/v1/volumes/1') res_dict = self.controller.show(req, 1) expected = {'volume': {'status': 'fakestatus', - 'displayDescription': 'displaydesc', - 'availabilityZone': 'fakeaz', - 'displayName': 'displayname', + 'display_description': 'displaydesc', + 'availability_zone': 'fakeaz', + 'display_name': 'displayname', 'attachments': [], - 'volumeType': 'vol_type_name', - 'snapshotId': None, + 'volume_type': 'vol_type_name', + 'snapshot_id': None, 'metadata': {}, 'id': '1', - 'createdAt': datetime.datetime(1, 1, 1, + 'created_at': datetime.datetime(1, 1, 1, 1, 1, 1), 'size': 1}} self.assertEqual(res_dict, expected) @@ -180,15 +180,15 @@ class VolumeApiTest(test.TestCase): class VolumeSerializerTest(test.TestCase): def _verify_volume_attachment(self, attach, tree): - for attr in ('id', 'volumeId', 'serverId', 'device'): + for attr in ('id', 'volume_id', 'server_id', 'device'): self.assertEqual(str(attach[attr]), tree.get(attr)) def _verify_volume(self, vol, tree): self.assertEqual(tree.tag, 'volume') - for attr in ('id', 'status', 'size', 'availabilityZone', 'createdAt', - 'displayName', 'displayDescription', 'volumeType', - 'snapshotId'): + for attr in ('id', 'status', 'size', 'availability_zone', 'created_at', + 'display_name', 'display_description', 'volume_type', + 'snapshot_id'): self.assertEqual(str(vol[attr]), tree.get(attr)) for child in tree: @@ -212,17 +212,17 @@ class VolumeSerializerTest(test.TestCase): id='vol_id', status='vol_status', size=1024, - availabilityZone='vol_availability', - createdAt=datetime.datetime.now(), + availability_zone='vol_availability', + created_at=datetime.datetime.now(), attachments=[dict( id='vol_id', - volumeId='vol_id', - serverId='instance_uuid', + volume_id='vol_id', + server_id='instance_uuid', device='/foo')], - displayName='vol_name', - displayDescription='vol_desc', - volumeType='vol_type', - snapshotId='snap_id', + display_name='vol_name', + display_description='vol_desc', + volume_type='vol_type', + snapshot_id='snap_id', metadata=dict( foo='bar', baz='quux', @@ -241,17 +241,17 @@ class VolumeSerializerTest(test.TestCase): id='vol1_id', status='vol1_status', size=1024, - availabilityZone='vol1_availability', - createdAt=datetime.datetime.now(), + availability_zone='vol1_availability', + created_at=datetime.datetime.now(), attachments=[dict( id='vol1_id', - volumeId='vol1_id', - serverId='instance_uuid', + volume_id='vol1_id', + server_id='instance_uuid', device='/foo1')], - displayName='vol1_name', - displayDescription='vol1_desc', - volumeType='vol1_type', - snapshotId='snap1_id', + display_name='vol1_name', + display_description='vol1_desc', + volume_type='vol1_type', + snapshot_id='snap1_id', metadata=dict( foo='vol1_foo', bar='vol1_bar', @@ -261,17 +261,17 @@ class VolumeSerializerTest(test.TestCase): id='vol2_id', status='vol2_status', size=1024, - availabilityZone='vol2_availability', - createdAt=datetime.datetime.now(), + availability_zone='vol2_availability', + created_at=datetime.datetime.now(), attachments=[dict( id='vol2_id', - volumeId='vol2_id', - serverId='instance_uuid', + volume_id='vol2_id', + server_id='instance_uuid', device='/foo2')], - displayName='vol2_name', - displayDescription='vol2_desc', - volumeType='vol2_type', - snapshotId='snap2_id', + display_name='vol2_name', + display_description='vol2_desc', + volume_type='vol2_type', + snapshot_id='snap2_id', metadata=dict( foo='vol2_foo', bar='vol2_bar', diff --git a/nova/tests/integrated/test_volumes.py b/nova/tests/integrated/test_volumes.py index 8a6089595..8ad2e2bef 100644 --- a/nova/tests/integrated/test_volumes.py +++ b/nova/tests/integrated/test_volumes.py @@ -175,7 +175,7 @@ class VolumesTest(integrated_helpers._IntegratedTestBase): # Check it's there and availability zone present found_volume = self.api.get_volume(created_volume_id) self.assertEqual(created_volume_id, found_volume['id']) - self.assertEqual(availability_zone, found_volume['availabilityZone']) + self.assertEqual(availability_zone, found_volume['availability_zone']) if __name__ == "__main__": unittest.main() |
