From 1051a469440b3caeb94a01375c1d5e553acedf4b Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Mon, 29 Jun 2015 12:25:30 -0400 Subject: [PATCH] Alphabetize tests for v1 qos_specs As a follow up of sorting the methods for volume v1 qos_specs. Change-Id: I428167297e7110e586d139bf38fd22d321836e80 --- .../tests/volume/v1/test_qos_specs.py | 178 +++++++++--------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/openstackclient/tests/volume/v1/test_qos_specs.py b/openstackclient/tests/volume/v1/test_qos_specs.py index fd03c6cc1f..da7adc32e5 100644 --- a/openstackclient/tests/volume/v1/test_qos_specs.py +++ b/openstackclient/tests/volume/v1/test_qos_specs.py @@ -32,6 +32,41 @@ class TestQos(volume_fakes.TestVolumev1): self.types_mock.reset_mock() +class TestQosAssociate(TestQos): + def setUp(self): + super(TestQosAssociate, self).setUp() + + # Get the command object to test + self.cmd = qos_specs.AssociateQos(self.app, None) + + def test_qos_associate(self): + self.qos_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(volume_fakes.QOS), + loaded=True + ) + self.types_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(volume_fakes.TYPE), + loaded=True + ) + arglist = [ + volume_fakes.qos_id, + volume_fakes.type_id + ] + verifylist = [ + ('qos_specs', volume_fakes.qos_id), + ('volume_type', volume_fakes.type_id) + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + self.qos_mock.associate.assert_called_with( + volume_fakes.qos_id, + volume_fakes.type_id + ) + + class TestQosCreate(TestQos): def setUp(self): super(TestQosCreate, self).setUp() @@ -196,6 +231,60 @@ class TestQosDelete(TestQos): self.qos_mock.delete.assert_called_with(volume_fakes.qos_id) +class TestQosDisassociate(TestQos): + def setUp(self): + super(TestQosDisassociate, self).setUp() + + # Get the command object to test + self.cmd = qos_specs.DisassociateQos(self.app, None) + + def test_qos_disassociate_with_volume_type(self): + self.qos_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(volume_fakes.QOS), + loaded=True + ) + self.types_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(volume_fakes.TYPE), + loaded=True + ) + arglist = [ + volume_fakes.qos_id, + '--volume-type', volume_fakes.type_id + ] + verifylist = [ + ('qos_specs', volume_fakes.qos_id), + ('volume_type', volume_fakes.type_id) + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + self.qos_mock.disassociate.assert_called_with( + volume_fakes.qos_id, + volume_fakes.type_id + ) + + def test_qos_disassociate_with_all_volume_types(self): + self.qos_mock.get.return_value = fakes.FakeResource( + None, + copy.deepcopy(volume_fakes.QOS), + loaded=True + ) + + arglist = [ + volume_fakes.qos_id, + '--all' + ] + verifylist = [ + ('qos_specs', volume_fakes.qos_id) + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + self.qos_mock.disassociate_all.assert_called_with(volume_fakes.qos_id) + + class TestQosSet(TestQos): def setUp(self): super(TestQosSet, self).setUp() @@ -257,92 +346,3 @@ class TestQosUnset(TestQos): volume_fakes.qos_id, ['iops', 'foo'] ) - - -class TestQosAssociate(TestQos): - def setUp(self): - super(TestQosAssociate, self).setUp() - - # Get the command object to test - self.cmd = qos_specs.AssociateQos(self.app, None) - - def test_qos_associate(self): - self.qos_mock.get.return_value = fakes.FakeResource( - None, - copy.deepcopy(volume_fakes.QOS), - loaded=True - ) - self.types_mock.get.return_value = fakes.FakeResource( - None, - copy.deepcopy(volume_fakes.TYPE), - loaded=True - ) - arglist = [ - volume_fakes.qos_id, - volume_fakes.type_id - ] - verifylist = [ - ('qos_specs', volume_fakes.qos_id), - ('volume_type', volume_fakes.type_id) - ] - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - - self.cmd.take_action(parsed_args) - self.qos_mock.associate.assert_called_with( - volume_fakes.qos_id, - volume_fakes.type_id - ) - - -class TestQosDisassociate(TestQos): - def setUp(self): - super(TestQosDisassociate, self).setUp() - - # Get the command object to test - self.cmd = qos_specs.DisassociateQos(self.app, None) - - def test_qos_disassociate_with_volume_type(self): - self.qos_mock.get.return_value = fakes.FakeResource( - None, - copy.deepcopy(volume_fakes.QOS), - loaded=True - ) - self.types_mock.get.return_value = fakes.FakeResource( - None, - copy.deepcopy(volume_fakes.TYPE), - loaded=True - ) - arglist = [ - volume_fakes.qos_id, - '--volume-type', volume_fakes.type_id - ] - verifylist = [ - ('qos_specs', volume_fakes.qos_id), - ('volume_type', volume_fakes.type_id) - ] - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - - self.cmd.take_action(parsed_args) - self.qos_mock.disassociate.assert_called_with( - volume_fakes.qos_id, - volume_fakes.type_id - ) - - def test_qos_disassociate_with_all_volume_types(self): - self.qos_mock.get.return_value = fakes.FakeResource( - None, - copy.deepcopy(volume_fakes.QOS), - loaded=True - ) - - arglist = [ - volume_fakes.qos_id, - '--all' - ] - verifylist = [ - ('qos_specs', volume_fakes.qos_id) - ] - parsed_args = self.check_parser(self.cmd, arglist, verifylist) - - self.cmd.take_action(parsed_args) - self.qos_mock.disassociate_all.assert_called_with(volume_fakes.qos_id)