From: Thomas Goirand Date: Mon, 28 Jan 2013 07:53:55 +0000 (+0800) Subject: Merge tag '2013.1_g2' into debian/grizzly X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=aec45151fbe6ba5a6f3398307f50a15a47a8a2d5;p=openstack-build%2Fcinder-build.git Merge tag '2013.1_g2' into debian/grizzly grizzly-2 Conflicts: cinder/volume/san.py --- aec45151fbe6ba5a6f3398307f50a15a47a8a2d5 diff --cc cinder/tests/api/v1/test_snapshots.py index f9d61b39e,4bfe3e612..293323650 --- a/cinder/tests/api/v1/test_snapshots.py +++ b/cinder/tests/api/v1/test_snapshots.py @@@ -114,21 -114,62 +114,73 @@@ class SnapshotApiTest(test.TestCase) self.assertTrue('snapshot' in resp_dict) self.assertEqual(resp_dict['snapshot']['display_name'], - snapshot['display_name']) + snapshot['display_name']) self.assertEqual(resp_dict['snapshot']['display_description'], - snapshot['display_description']) + snapshot['display_description']) + + snapshot = {"volume_id": "12", + "force": "**&&^^%%$$##@@", + "display_name": "Snapshot Test Name", + "display_description": "Snapshot Test Desc"} + body = dict(snapshot=snapshot) + req = fakes.HTTPRequest.blank('/v1/snapshots') + self.assertRaises(exception.InvalidParameterValue, + self.controller.create, + req, + body) + + def test_snapshot_update(self): + self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get) + self.stubs.Set(volume.api.API, "update_snapshot", + stubs.stub_snapshot_update) + updates = {"display_name": "Updated Test Name", } + body = {"snapshot": updates} + req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID) + res_dict = self.controller.update(req, UUID, body) + expected = {'snapshot': { + 'id': UUID, + 'volume_id': 12, + 'status': 'available', + 'size': 100, + 'created_at': None, + 'display_name': 'Updated Test Name', + 'display_description': 'Default description', + }} + self.assertEquals(expected, res_dict) + + def test_snapshot_update_missing_body(self): + body = {} + req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID) + self.assertRaises(webob.exc.HTTPUnprocessableEntity, + self.controller.update, req, UUID, body) + + def test_snapshot_update_invalid_body(self): + body = {'display_name': 'missing top level snapshot key'} + req = fakes.HTTPRequest.blank('/v1/snapshots/%s' % UUID) + self.assertRaises(webob.exc.HTTPUnprocessableEntity, + self.controller.update, req, UUID, body) + + def test_snapshot_update_not_found(self): + self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get) + updates = { + "display_name": "Updated Test Name", + } + body = {"snapshot": updates} + req = fakes.HTTPRequest.blank('/v1/snapshots/not-the-uuid') + self.assertRaises(webob.exc.HTTPNotFound, self.controller.update, req, + 'not-the-uuid', body) + snapshot = {"volume_id": "12", + "force": "**&&^^%%$$##@@", + "display_name": "Snapshot Test Name", + "display_description": "Snapshot Test Desc"} + body = dict(snapshot=snapshot) + req = fakes.HTTPRequest.blank('/v1/snapshots') + self.assertRaises(exception.InvalidParameterValue, + self.controller.create, + req, + body) + def test_snapshot_delete(self): self.stubs.Set(volume.api.API, "get_snapshot", stub_snapshot_get) self.stubs.Set(volume.api.API, "delete_snapshot", stub_snapshot_delete) diff --cc cinder/version.py index 12714e12b,3f50863fc..b77646dc2 --- a/cinder/version.py +++ b/cinder/version.py @@@ -14,9 -14,9 +14,9 @@@ # License for the specific language governing permissions and limitations # under the License. - CINDER_VERSION = ['2012', '2', '1'] + CINDER_VERSION = ['2013', '1', None] YEAR, COUNT, REVISION = CINDER_VERSION -FINAL = False # This becomes true at Release Candidate time +FINAL = True # This becomes true at Release Candidate time def canonical_version_string():