Test the condition not the implementation

This commit is contained in:
David Ames
2019-12-10 08:36:22 -08:00
parent c109abbe25
commit 40e9c86df4
2 changed files with 2 additions and 2 deletions

View File

@@ -816,7 +816,7 @@ class TestOpenStackUtils(ut_utils.BaseTestCase):
_machine = mock.MagicMock()
# No machine returned
self._get_machines.side_effect = KeyError
self._get_machines.return_value = []
with self.assertRaises(exceptions.ApplicationNotFound):
openstack_utils.get_current_os_release_pair()
self._get_machines.side_effect = None

View File

@@ -1451,7 +1451,7 @@ def get_current_os_release_pair(application='keystone'):
"""
try:
machine = list(juju_utils.get_machines_for_application(application))[0]
except KeyError:
except IndexError:
raise exceptions.ApplicationNotFound(application)
series = juju_utils.get_machine_series(machine)