Skip to content

Commit e5dd054

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix errors in flavor unit tests"
2 parents e5e29a8 + c7e6973 commit e5dd054

1 file changed

Lines changed: 9 additions & 24 deletions

File tree

openstackclient/tests/compute/v2/test_flavor.py

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ def test_flavor_unset_property(self):
645645
result = self.cmd.take_action(parsed_args)
646646
self.flavors_mock.find.assert_called_with(name=parsed_args.flavor,
647647
is_public=None)
648+
self.flavor.unset_keys.assert_called_with(['property'])
649+
self.flavor_access_mock.remove_tenant_access.assert_not_called()
648650
self.assertIsNone(result)
649651

650652
def test_flavor_unset_project(self):
@@ -661,24 +663,14 @@ def test_flavor_unset_project(self):
661663
result = self.cmd.take_action(parsed_args)
662664
self.assertIsNone(result)
663665

666+
self.flavors_mock.find.assert_called_with(name=parsed_args.flavor,
667+
is_public=None)
664668
self.flavor_access_mock.remove_tenant_access.assert_called_with(
665669
self.flavor.id,
666670
identity_fakes.project_id,
667671
)
668-
669-
def test_flavor_unset_no_project(self):
670-
arglist = [
671-
'--project', '',
672-
self.flavor.id,
673-
]
674-
verifylist = [
675-
('project', ''),
676-
('flavor', self.flavor.id),
677-
]
678-
679-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
680-
self.assertRaises(exceptions.CommandError, self.cmd.take_action,
681-
parsed_args)
672+
self.flavor.unset_keys.assert_not_called()
673+
self.assertIsNone(result)
682674

683675
def test_flavor_unset_no_flavor(self):
684676
arglist = [
@@ -687,12 +679,8 @@ def test_flavor_unset_no_flavor(self):
687679
verifylist = [
688680
('project', identity_fakes.project_id),
689681
]
690-
691-
self.assertRaises(tests_utils.ParserException,
692-
self.check_parser,
693-
self.cmd,
694-
arglist,
695-
verifylist)
682+
self.assertRaises(tests_utils.ParserException, self.check_parser,
683+
self.cmd, arglist, verifylist)
696684

697685
def test_flavor_unset_with_unexist_flavor(self):
698686
self.flavors_mock.get.side_effect = exceptions.NotFound(None)
@@ -707,9 +695,7 @@ def test_flavor_unset_with_unexist_flavor(self):
707695
('flavor', 'unexist_flavor'),
708696
]
709697
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
710-
711-
self.assertRaises(exceptions.CommandError,
712-
self.cmd.take_action,
698+
self.assertRaises(exceptions.CommandError, self.cmd.take_action,
713699
parsed_args)
714700

715701
def test_flavor_unset_nothing(self):
@@ -719,7 +705,6 @@ def test_flavor_unset_nothing(self):
719705
verifylist = [
720706
('flavor', self.flavor.id),
721707
]
722-
723708
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
724709
self.assertRaises(exceptions.CommandError, self.cmd.take_action,
725710
parsed_args)

0 commit comments

Comments
 (0)