def test_resource_reaches_status(self):
     self.patch_object(openstack_utils, "_resource_reaches_status")
     self._resource_reaches_status.return_value = True
     openstack_utils._resource_reaches_status('resource', 'e01df65a')
     self._resource_reaches_status.assert_called_once_with(
         'resource',
         'e01df65a')
 def test__resource_reaches_status_fail(self):
     resource_mock = mock.MagicMock()
     resource_mock.get.return_value = mock.MagicMock(status='unavailable')
     with self.assertRaises(AssertionError):
         openstack_utils._resource_reaches_status(
             resource_mock,
             'e01df65a')
 def test__resource_reaches_status_bespoke(self):
     resource_mock = mock.MagicMock()
     resource_mock.get.return_value = mock.MagicMock(status='readyish')
     openstack_utils._resource_reaches_status(
         resource_mock,
         'e01df65a',
         'readyish')
 def test_resource_reaches_status_custom_retry(self):
     self.patch_object(openstack_utils, "_resource_reaches_status")
     self._resource_reaches_status.return_value = True
     openstack_utils._resource_reaches_status(
         'resource',
         'e01df65a',
         wait_exponential_multiplier=2,
         wait_iteration_max_time=20,
         stop_after_attempt=2)
     self._resource_reaches_status.assert_called_once_with(
         'resource',
         'e01df65a',
         stop_after_attempt=2,
         wait_exponential_multiplier=2,
         wait_iteration_max_time=20)
 def test__resource_reaches_status(self):
     resource_mock = mock.MagicMock()
     resource_mock.get.return_value = mock.MagicMock(status='available')
     openstack_utils._resource_reaches_status(resource_mock, 'e01df65a')