~ubuntu-branches/ubuntu/trusty/python-cinderclient/trusty

« back to all changes in this revision

Viewing changes to cinderclient/tests/v1/test_shell.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-03-06 15:15:14 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140306151514-ihbixyaopbhaqdju
Tags: 1:1.0.8-0ubuntu1
* New upstream release.
* debian/patches/fix-search-opts.patch: Dropped no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
 
87
87
        for input in inputs:
88
88
            args = Arguments(metadata=input[0])
89
 
            self.assertEquals(shell_v1._extract_metadata(args), input[1])
 
89
            self.assertEqual(shell_v1._extract_metadata(args), input[1])
90
90
 
91
91
    def test_list(self):
92
92
        self.run_command('list')
124
124
 
125
125
    def test_delete_multiple(self):
126
126
        self.run_command('delete 1234 5678')
 
127
        self.assert_called_anytime('DELETE', '/volumes/1234')
127
128
        self.assert_called('DELETE', '/volumes/5678')
128
129
 
129
130
    def test_backup(self):
211
212
        expected = {'os-reset_status': {'status': 'error'}}
212
213
        self.assert_called('POST', '/volumes/1234/action', body=expected)
213
214
 
 
215
    def test_reset_state_multiple(self):
 
216
        self.run_command('reset-state 1234 5678 --state error')
 
217
        expected = {'os-reset_status': {'status': 'error'}}
 
218
        self.assert_called_anytime('POST', '/volumes/1234/action',
 
219
                                   body=expected)
 
220
        self.assert_called_anytime('POST', '/volumes/5678/action',
 
221
                                   body=expected)
 
222
 
214
223
    def test_snapshot_reset_state(self):
215
224
        self.run_command('snapshot-reset-state 1234')
216
225
        expected = {'os-reset_status': {'status': 'available'}}
221
230
        expected = {'os-reset_status': {'status': 'error'}}
222
231
        self.assert_called('POST', '/snapshots/1234/action', body=expected)
223
232
 
 
233
    def test_snapshot_reset_state_multiple(self):
 
234
        self.run_command('snapshot-reset-state 1234 5678')
 
235
        expected = {'os-reset_status': {'status': 'available'}}
 
236
        self.assert_called_anytime('POST', '/snapshots/1234/action',
 
237
                                   body=expected)
 
238
        self.assert_called_anytime('POST', '/snapshots/5678/action',
 
239
                                   body=expected)
 
240
 
224
241
    def test_encryption_type_list(self):
225
242
        """
226
243
        Test encryption-type-list shell command.
275
292
    def test_encryption_type_delete(self):
276
293
        """
277
294
        Test encryption-type-delete shell command.
 
295
 
 
296
        Verify one GET/one DELETE requests are made per command invocation:
 
297
        - one GET request to retrieve the relevant volume type information
 
298
        - one DELETE request to delete the encryption type information
278
299
        """
279
 
        self.skipTest("Not implemented")
 
300
        self.run_command('encryption-type-delete 1')
 
301
        self.assert_called('DELETE', '/types/1/encryption/provider')
 
302
        self.assert_called_anytime('GET', '/types/1')
280
303
 
281
304
    def test_migrate_volume(self):
282
305
        self.run_command('migrate 1234 fakehost --force-host-copy=True')
318
341
        self.run_command('readonly-mode-update 1234 False')
319
342
        expected = {'os-update_readonly_flag': {'readonly': False}}
320
343
        self.assert_called('POST', '/volumes/1234/action', body=expected)
 
344
 
 
345
    def test_service_disable(self):
 
346
        self.run_command('service-disable host cinder-volume')
 
347
        self.assert_called('PUT', '/os-services/disable',
 
348
                           {"binary": "cinder-volume", "host": "host"})
 
349
 
 
350
    def test_service_disable(self):
 
351
        self.run_command('service-enable host cinder-volume')
 
352
        self.assert_called('PUT', '/os-services/enable',
 
353
                           {"binary": "cinder-volume", "host": "host"})
 
354
 
 
355
    def test_snapshot_delete(self):
 
356
        self.run_command('snapshot-delete 1234')
 
357
        self.assert_called('DELETE', '/snapshots/1234')