~ubuntu-branches/ubuntu/raring/cinder/raring-updates

« back to all changes in this revision

Viewing changes to cinder/tests/api/contrib/test_types_extra_specs.py

  • Committer: Package Import Robot
  • Author(s): James Page, Chuck Short, James Page
  • Date: 2013-03-16 09:30:20 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20130316093020-xnaqjbr18uhkti6l
Tags: 1:2013.1~rc1-0ubuntu1
[ Chuck Short ]
* debian/patches/fix-ubuntu-tests.patch: Dropped.
* debian/rules: Fix version number when building the testsuite. 
* debian/cinder-backup{.install, upstart, logroate}: Add cinder-backup
  service.
* debian/rules: Run the testsuite against PYTHONPATH.
* debian/control: Update build-depends and run-time depends.
  - Dropped python-glance not needed.
  - Dropped python-cheetah not needed.
  - Droped python-daemon not needed.
  - Dropped python-netaddr not needed.
  - Renamed python-oslo-config to python-oslo.config.
  - Added python-keystoneclient to depends.
  - Added python-swiftclient to depends.
 * debian/pydist-overrides: No longer needed.

[ James Page ]
* New upstream release candidate.
* d/watch: Update uversionmangle to deal with upstream versioning
  changes, remove tarballs.openstack.org.
* d/cinder.conf: Set lock_path to /var/lock/cinder (default is not
  sensible).

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
    def test_update_empty_body(self):
163
163
        self._extra_specs_empty_update(body={})
164
164
 
 
165
    def _extra_specs_create_bad_body(self, body):
 
166
        req = fakes.HTTPRequest.blank('/v2/fake/types/1/extra_specs')
 
167
        req.method = 'POST'
 
168
        self.assertRaises(webob.exc.HTTPBadRequest,
 
169
                          self.controller.create, req, '1', body)
 
170
 
 
171
    def test_create_no_body(self):
 
172
        self._extra_specs_create_bad_body(body=None)
 
173
 
 
174
    def test_create_missing_volume(self):
 
175
        body = {'foo': {'a': 'b'}}
 
176
        self._extra_specs_create_bad_body(body=body)
 
177
 
 
178
    def test_create_malformed_entity(self):
 
179
        body = {'extra_specs': 'string'}
 
180
        self._extra_specs_create_bad_body(body=body)
 
181
 
165
182
 
166
183
class VolumeTypeExtraSpecsSerializerTest(test.TestCase):
167
184
    def test_index_create_serializer(self):
195
212
        self.assertEqual('key1', tree.tag)
196
213
        self.assertEqual('value1', tree.text)
197
214
        self.assertEqual(0, len(tree))
198
 
 
199
 
 
200
 
class VolumeTypeExtraSpecsUnprocessableEntityTestCase(test.TestCase):
201
 
 
202
 
    """
203
 
    Tests of places we throw 422 Unprocessable Entity from
204
 
    """
205
 
 
206
 
    def setUp(self):
207
 
        super(VolumeTypeExtraSpecsUnprocessableEntityTestCase, self).setUp()
208
 
        self.controller = types_extra_specs.VolumeTypeExtraSpecsController()
209
 
 
210
 
    def _unprocessable_extra_specs_create(self, body):
211
 
        req = fakes.HTTPRequest.blank('/v2/fake/types/1/extra_specs')
212
 
        req.method = 'POST'
213
 
 
214
 
        self.assertRaises(webob.exc.HTTPUnprocessableEntity,
215
 
                          self.controller.create, req, '1', body)
216
 
 
217
 
    def test_create_no_body(self):
218
 
        self._unprocessable_extra_specs_create(body=None)
219
 
 
220
 
    def test_create_missing_volume(self):
221
 
        body = {'foo': {'a': 'b'}}
222
 
        self._unprocessable_extra_specs_create(body=body)
223
 
 
224
 
    def test_create_malformed_entity(self):
225
 
        body = {'extra_specs': 'string'}
226
 
        self._unprocessable_extra_specs_create(body=body)