]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge tag '2013.1_g2' into debian/grizzly
authorThomas Goirand <thomas@goirand.fr>
Mon, 28 Jan 2013 07:53:55 +0000 (15:53 +0800)
committerThomas Goirand <thomas@goirand.fr>
Mon, 28 Jan 2013 07:53:55 +0000 (15:53 +0800)
grizzly-2

Conflicts:
cinder/volume/san.py

1  2 
cinder/tests/api/v1/test_snapshots.py
cinder/version.py

index f9d61b39ee059b47c89351bed49c4c3f66cd9cb6,4bfe3e61295edde54e45d06e3bed2a935705915e..293323650c1bb8fa398fb318e72ab81e64b70d42
@@@ -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)
index 12714e12b2b076312713befaf4ffd3ba036fa4e8,3f50863fccc8e8da0869b86ebb83f58325dcc1b5..b77646dc23be21e4adfe625099ec7a88069e7785
@@@ -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():