summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'cinderclient/tests/unit')
-rw-r--r--cinderclient/tests/unit/v2/test_shell.py19
-rw-r--r--cinderclient/tests/unit/v2/test_volumes.py6
2 files changed, 25 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/v2/test_shell.py b/cinderclient/tests/unit/v2/test_shell.py
index 3a88691..d183564 100644
--- a/cinderclient/tests/unit/v2/test_shell.py
+++ b/cinderclient/tests/unit/v2/test_shell.py
@@ -496,6 +496,25 @@ class ShellTest(utils.TestCase):
expected = {'os-reset_status': {'status': 'error'}}
self.assert_called('POST', '/volumes/1234/action', body=expected)
+ def test_reset_state_with_attach_status(self):
+ self.run_command('reset-state --attach-status detached 1234')
+ expected = {'os-reset_status': {'status': 'available',
+ 'attach_status': 'detached'}}
+ self.assert_called('POST', '/volumes/1234/action', body=expected)
+
+ def test_reset_state_with_attach_status_with_flag(self):
+ self.run_command('reset-state --state in-use '
+ '--attach-status attached 1234')
+ expected = {'os-reset_status': {'status': 'in-use',
+ 'attach_status': 'attached'}}
+ self.assert_called('POST', '/volumes/1234/action', body=expected)
+
+ def test_reset_state_with_reset_migration_status(self):
+ self.run_command('reset-state --reset-migration-status 1234')
+ expected = {'os-reset_status': {'status': 'available',
+ 'migration_status': 'none'}}
+ self.assert_called('POST', '/volumes/1234/action', body=expected)
+
def test_reset_state_multiple(self):
self.run_command('reset-state 1234 5678 --state error')
expected = {'os-reset_status': {'status': 'error'}}
diff --git a/cinderclient/tests/unit/v2/test_volumes.py b/cinderclient/tests/unit/v2/test_volumes.py
index 08b9678..5260238 100644
--- a/cinderclient/tests/unit/v2/test_volumes.py
+++ b/cinderclient/tests/unit/v2/test_volumes.py
@@ -160,6 +160,12 @@ class VolumesTest(utils.TestCase):
cs.volumes.extend(v, 2)
cs.assert_called('POST', '/volumes/1234/action')
+ def test_reset_state(self):
+ v = cs.volumes.get('1234')
+ cs.volumes.reset_state(v, 'in-use', attach_status='detached',
+ migration_status='none')
+ cs.assert_called('POST', '/volumes/1234/action')
+
def test_get_encryption_metadata(self):
cs.volumes.get_encryption_metadata('1234')
cs.assert_called('GET', '/volumes/1234/encryption')