コード例 #1
0
    def test_delete_already_gone(self):
        rsrc = self.create_remote_stack()

        self.heat.stacks.delete = mock.MagicMock(
            side_effect=exc.HTTPNotFound())
        self.heat.stacks.get = mock.MagicMock(side_effect=exc.HTTPNotFound())

        remote_stack_id = rsrc.resource_id
        scheduler.TaskRunner(rsrc.delete)()

        self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
        self.heat.stacks.delete.assert_called_with(stack_id=remote_stack_id)
コード例 #2
0
 def test_snapshot_list_error(self):
     self.stack_client.snapshot_list.side_effect = heat_exc.HTTPNotFound()
     arglist = ['my_stack']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     error = self.assertRaises(exc.CommandError, self.cmd.take_action,
                               parsed_args)
     self.assertEqual('Stack not found: my_stack', str(error))
コード例 #3
0
ファイル: test_engine.py プロジェクト: ekasitk/sahara
    def test_calls_order(self, logger, heat_client, _job_ex, _db_ob, _shutdown,
                         _delete_aa):
        class FakeHeatEngine(heat_engine.HeatEngine):
            def __init__(self):
                super(FakeHeatEngine, self).__init__()
                self.order = []

            def _clean_job_executions(self, cluster):
                self.order.append('clean_job_executions')
                super(FakeHeatEngine, self)._clean_job_executions(cluster)

            def _remove_db_objects(self, cluster):
                self.order.append('remove_db_objects')
                super(FakeHeatEngine, self)._remove_db_objects(cluster)

            def _shutdown_instances(self, cluster):
                self.order.append('shutdown_instances')
                super(FakeHeatEngine, self)._shutdown_instances(cluster)

            def _delete_aa_server_group(self, cluster):
                self.order.append('delete_aa_server_group')
                super(FakeHeatEngine, self)._delete_aa_server_group(cluster)

        fake_cluster = mock.Mock()
        heat_client.side_effect = heat_exc.HTTPNotFound()
        engine = FakeHeatEngine()
        engine.shutdown_cluster(fake_cluster)
        self.assertEqual([
            'shutdown_instances', 'delete_aa_server_group',
            'clean_job_executions', 'remove_db_objects'
        ], engine.order)
        self.assertEqual([
            mock.call('Did not find stack for cluster. Trying to '
                      'delete cluster manually.')
        ], logger.call_args_list)
コード例 #4
0
 def test_deployment_delete_not_found(self):
     arglist = ['test_deployment', 'test_deployment2']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.sd_client.delete.side_effect = heat_exc.HTTPNotFound()
     error = self.assertRaises(
         exc.CommandError, self.cmd.take_action, parsed_args)
     self.assertIn("Unable to delete 2 of the 2 deployments.", str(error))
コード例 #5
0
 def test_event_show_event_not_found(self):
     error = 'Event not found'
     self.stack_client.get = mock.MagicMock()
     self.resource_client.get = mock.MagicMock()
     self.event_client.get = mock.MagicMock(
         side_effect=exc.HTTPNotFound(error))
     self._test_not_found(error)
コード例 #6
0
 def test_get_stack_not_found_fails(self, mock_heat_client_init):
     mock_heat_client = mock_heat_client_init.return_value
     mock_heat_client.stacks.get.side_effect = heatexc.HTTPNotFound('Not found')
     mock_session = MagicMock()
     heat_driver = HeatDriver(mock_session)
     with self.assertRaises(StackNotFoundError) as context:
         heat_driver.get_stack('12345')
     self.assertEqual(str(context.exception), 'ERROR: Not found')
コード例 #7
0
 def test_deployment_not_found(self):
     arglist = ['my_deployment']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.sd_client.get.side_effect = heat_exc.HTTPNotFound()
     self.assertRaises(
         exc.CommandError,
         self.cmd.take_action,
         parsed_args)
コード例 #8
0
 def test_build_software_deployments_not_found(self):
     resources = {
         'stack.my_server': self.working_resource,
         'stack.my_deployment': self.failed_deployment_resource
     }
     self.software_deployments_client.get.side_effect = exc.HTTPNotFound()
     deployments = self.cmd._build_software_deployments(resources)
     self.assertEqual({}, deployments)
コード例 #9
0
 def test_deployment_output_show_not_found(self):
     arglist = ['85c3a507-351b-4b28-a7d8-531c8d53f4e6', '--all']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.sd_client.get.side_effect = heat_exc.HTTPNotFound()
     self.assertRaises(
         exc.CommandError,
         self.cmd.take_action,
         parsed_args)
コード例 #10
0
 def test_deployment_config_delete_failed(self):
     arglist = ['test_deployment']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.config_client.delete = mock.Mock()
     self.config_client.delete.side_effect = heat_exc.HTTPNotFound()
     error = self.assertRaises(
         exc.CommandError, self.cmd.take_action, parsed_args)
     self.assertEqual("Unable to delete 1 of the 1 deployments.",
                      str(error))
コード例 #11
0
def get_stack_status(heat_client, stack_id):
    # stack.get operation may take long time and run out of time. The reason
    # is that it resolves all outputs which is done serially. On the other hand
    # stack status can be retrieved from the list operation. Internally listing
    # supports paging and every request should not take too long.
    for stack in heat_client.stacks.list():
        if stack.id == stack_id:
            return stack.status, stack.stack_status_reason
    raise exc.HTTPNotFound(message='Stack %s is not found' % stack_id)
コード例 #12
0
 def test_get_message_fail_back(self):
     parts = [{'config': '#!/bin/bash', 'type': 'text'}]
     self.init_config(parts=parts)
     self.software_configs.get.side_effect = exc.HTTPNotFound()
     result = self.config.get_message()
     message = email.message_from_string(result)
     self.assertTrue(message.is_multipart())
     subs = message.get_payload()
     self.assertEqual(1, len(subs))
     self.assertEqual('#!/bin/bash', subs[0].get_payload())
コード例 #13
0
 def test_search_resoutce_until_status_http_error(self):
     self._base_heat_backend._name = "fake name"
     raised_exception = exceptions.ArgusError('Stack not found: %s' %
                                              self._base_heat_backend._name)
     self._base_heat_backend._heat_client.resources.list = mock.Mock()
     (self._base_heat_backend._heat_client.resources.list.side_effect
      ) = exc.HTTPNotFound()
     with self.assertRaises(exceptions.ArgusError) as ex:
         self._base_heat_backend._search_resource_until_status(
             mock.sentinel)
     self.assertEqual(ex.exception.message, str(raised_exception))
コード例 #14
0
 def test_nodegroup_delete_stack_not_found(self, mock_get_driver):
     mock_driver = mock.MagicMock()
     mock_get_driver.return_value = mock_driver
     nodegroup = mock.MagicMock()
     mock_driver.delete_nodegroup.side_effect = exc.HTTPNotFound()
     self.handler.nodegroup_delete(self.context, self.cluster, nodegroup)
     mock_driver.delete_nodegroup.assert_called_once_with(
         self.context, self.cluster, nodegroup)
     self.assertEqual(fields.ClusterStatus.UPDATE_IN_PROGRESS,
                      self.cluster.status)
     nodegroup.destroy.assert_called_once()
コード例 #15
0
    def test_no_stack(self, mock_get_orchestration, mock_get_object):

        mock_ctx = mock.MagicMock()

        not_found = heat_exc.HTTPNotFound()
        mock_get_orchestration.return_value.stacks.get.side_effect = not_found

        action = deployment.OvercloudRcAction("overcast")
        result = action.run(mock_ctx)

        self.assertEqual(
            result.error,
            ("The Heat stack overcast could not be found. Make sure you have "
             "deployed before calling this action."))
コード例 #16
0
    def test_build_failed_resources_not_found(self):
        self.resource_client.list.side_effect = [
            [
                # resource-list stack
                self.failed_template_resource,
                self.other_failed_template_resource,
                self.working_resource,
            ],
            exc.HTTPNotFound(),
            [  # resource-list dddd
            ]
        ]

        failures = self.cmd._build_failed_resources('stack')
        expected = collections.OrderedDict()
        expected['stack.my_templateresource'] = self.failed_template_resource
        expected['stack.my_othertemplateresource'] = (
            self.other_failed_template_resource)
        self.assertEqual(expected, failures)
コード例 #17
0
    def test_get_deployment_status_no_heat_stack(self, heat, mistral, swift):

        mock_stack = mock.Mock()
        mock_stack.stack_status = 'COMPLETE'
        heat().stacks.get.side_effect = heat_exc.HTTPNotFound()

        body = 'deployment_status: DEPLOY_SUCCESS'
        swift().get_object.return_value = [mock.Mock(), body]

        execution = mock.Mock()
        execution.updated_at = 1
        execution.state = 'SUCCESS'
        execution.output = '{"deployment_status":"DEPLOY_SUCCESS"}'
        mistral().executions.get.return_value = execution
        mistral().executions.find.return_value = [execution]

        action = deployment.DeploymentStatusAction(self.plan)
        result = action.run(self.ctx)

        self.assertEqual(result['status_update'], None)
        self.assertEqual(result['deployment_status'], None)
コード例 #18
0
ファイル: test_engine.py プロジェクト: zizzhang/sahara
    def test_calls_order(self, logger, heat_client, _job_ex, _db_ob):
        class FakeHeatEngine(heat_engine.HeatEngine):
            def __init__(self):
                super(FakeHeatEngine, self).__init__()
                self.order = []

            def _clean_job_executions(self, cluster):
                self.order.append('clean_job_executions')
                super(FakeHeatEngine, self)._clean_job_executions(cluster)

            def _remove_db_objects(self, cluster):
                self.order.append('remove_db_objects')
                super(FakeHeatEngine, self)._remove_db_objects(cluster)

        fake_cluster = mock.Mock()
        heat_client.side_effect = heat_exc.HTTPNotFound()
        engine = FakeHeatEngine()
        engine.shutdown_cluster(fake_cluster)
        self.assertEqual(['clean_job_executions', 'remove_db_objects'],
                         engine.order)
        self.assertEqual([mock.call('Did not find stack for cluster.')],
                         logger.call_args_list)
コード例 #19
0
 def _get(self, stack_id):
     try:
         return self.fake_stacks[stack_id]
     except KeyError:
         raise heat_exc.HTTPNotFound()
コード例 #20
0
class TestIsNotFound(common.HeatTestCase):

    scenarios = [
        ('ceilometer_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='ceilometer',
            exception=lambda: ceil_exc.HTTPNotFound(details='gone'),
        )),
        ('ceilometer_not_found_apiclient', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='ceilometer',
            exception=lambda: c_a_exc.NotFound(details='gone'),
        )),
        ('ceilometer_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='ceilometer',
            exception=lambda: Exception()
        )),
        ('ceilometer_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='ceilometer',
            exception=lambda: ceil_exc.HTTPOverLimit(details='over'),
        )),
        ('ceilometer_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='ceilometer',
            exception=lambda: ceil_exc.HTTPConflict(),
        )),
        ('cinder_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='cinder',
            exception=lambda: cinder_exc.NotFound(code=404),
        )),
        ('cinder_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='cinder',
            exception=lambda: Exception()
        )),
        ('cinder_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='cinder',
            exception=lambda: cinder_exc.OverLimit(code=413),
        )),
        ('cinder_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='cinder',
            exception=lambda: cinder_exc.ClientException(code=409),
        )),
        ('glance_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='glance',
            exception=lambda: glance_exc.HTTPNotFound(details='gone'),
        )),
        ('glance_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='glance',
            exception=lambda: Exception()
        )),
        ('glance_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='glance',
            exception=lambda: glance_exc.HTTPOverLimit(details='over'),
        )),
        ('glance_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='glance',
            exception=lambda: glance_exc.HTTPConflict(),
        )),
        ('heat_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='heat',
            exception=lambda: heat_exc.HTTPNotFound(message='gone'),
        )),
        ('heat_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='heat',
            exception=lambda: Exception()
        )),
        ('heat_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='heat',
            exception=lambda: heat_exc.HTTPOverLimit(message='over'),
        )),
        ('heat_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='heat',
            exception=lambda: heat_exc.HTTPConflict(),
        )),
        ('keystone_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='keystone',
            exception=lambda: keystone_exc.NotFound(details='gone'),
        )),
        ('keystone_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='keystone',
            exception=lambda: Exception()
        )),
        ('keystone_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='keystone',
            exception=lambda: keystone_exc.RequestEntityTooLarge(
                details='over'),
        )),
        ('keystone_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='keystone',
            exception=lambda: keystone_exc.Conflict(
                message='Conflict'),
        )),
        ('neutron_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: neutron_exc.NotFound,
        )),
        ('neutron_network_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: neutron_exc.NetworkNotFoundClient(),
        )),
        ('neutron_port_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: neutron_exc.PortNotFoundClient(),
        )),
        ('neutron_status_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: neutron_exc.NeutronClientException(
                status_code=404),
        )),
        ('neutron_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: Exception()
        )),
        ('neutron_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='neutron',
            exception=lambda: neutron_exc.NeutronClientException(
                status_code=413),
        )),
        ('neutron_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='neutron',
            exception=lambda: neutron_exc.Conflict(),
        )),
        ('nova_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            is_unprocessable_entity=False,
            plugin='nova',
            exception=lambda: fakes_nova.fake_exception(),
        )),
        ('nova_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            is_unprocessable_entity=False,
            plugin='nova',
            exception=lambda: Exception()
        )),
        ('nova_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            is_unprocessable_entity=False,
            plugin='nova',
            exception=lambda: fakes_nova.fake_exception(413),
        )),
        ('nova_unprocessable_entity', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            is_unprocessable_entity=True,
            plugin='nova',
            exception=lambda: fakes_nova.fake_exception(422),
        )),
        ('nova_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            is_unprocessable_entity=False,
            plugin='nova',
            exception=lambda: fakes_nova.fake_exception(409),
        )),
        ('swift_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='swift',
            exception=lambda: swift_exc.ClientException(
                msg='gone', http_status=404),
        )),
        ('swift_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='swift',
            exception=lambda: Exception()
        )),
        ('swift_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='swift',
            exception=lambda: swift_exc.ClientException(
                msg='ouch', http_status=413),
        )),
        ('swift_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='swift',
            exception=lambda: swift_exc.ClientException(
                msg='conflict', http_status=409),
        )),
        ('trove_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='trove',
            exception=lambda: troveclient.exceptions.NotFound(message='gone'),
        )),
        ('trove_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='trove',
            exception=lambda: Exception()
        )),
        ('trove_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='trove',
            exception=lambda: troveclient.exceptions.RequestEntityTooLarge(
                message='over'),
        )),
        ('trove_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='trove',
            exception=lambda: troveclient.exceptions.Conflict(
                message='Conflict'),
        )),
        ('sahara_not_found', dict(
            is_not_found=True,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=False,
            plugin='sahara',
            exception=lambda: sahara_base.APIException(
                error_message='gone1', error_code=404),
        )),
        ('sahara_exception', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=False,
            is_conflict=False,
            plugin='sahara',
            exception=lambda: Exception()
        )),
        ('sahara_overlimit', dict(
            is_not_found=False,
            is_over_limit=True,
            is_client_exception=True,
            is_conflict=False,
            plugin='sahara',
            exception=lambda: sahara_base.APIException(
                error_message='over1', error_code=413),
        )),
        ('sahara_conflict', dict(
            is_not_found=False,
            is_over_limit=False,
            is_client_exception=True,
            is_conflict=True,
            plugin='sahara',
            exception=lambda: sahara_base.APIException(
                error_message='conflict1', error_code=409),
        )),
    ]

    def test_is_not_found(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            raise self.exception()
        except Exception as e:
            if self.is_not_found != client_plugin.is_not_found(e):
                raise

    def test_ignore_not_found(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            exp = self.exception()
            exp_class = exp.__class__
            raise exp
        except Exception as e:
            if self.is_not_found:
                client_plugin.ignore_not_found(e)
            else:
                self.assertRaises(exp_class,
                                  client_plugin.ignore_not_found,
                                  e)

    def test_ignore_conflict_and_not_found(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            exp = self.exception()
            exp_class = exp.__class__
            raise exp
        except Exception as e:
            if self.is_conflict or self.is_not_found:
                client_plugin.ignore_conflict_and_not_found(e)
            else:
                self.assertRaises(exp_class,
                                  client_plugin.ignore_conflict_and_not_found,
                                  e)

    def test_is_over_limit(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            raise self.exception()
        except Exception as e:
            if self.is_over_limit != client_plugin.is_over_limit(e):
                raise

    def test_is_client_exception(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            raise self.exception()
        except Exception as e:
            ice = self.is_client_exception
            actual = client_plugin.is_client_exception(e)
            if ice != actual:
                raise

    def test_is_conflict(self):
        con = mock.Mock()
        c = clients.Clients(con)
        client_plugin = c.client_plugin(self.plugin)
        try:
            raise self.exception()
        except Exception as e:
            if self.is_conflict != client_plugin.is_conflict(e):
                raise

    def test_is_unprocessable_entity(self):
        con = mock.Mock()
        c = clients.Clients(con)
        # only 'nova' client plugin need to check this exception
        if self.plugin == 'nova':
            client_plugin = c.client_plugin(self.plugin)
            try:
                raise self.exception()
            except Exception as e:
                iue = self.is_unprocessable_entity
                if iue != client_plugin.is_unprocessable_entity(e):
                    raise
コード例 #21
0
 def _update(self, stack_id, existing, parameters):
     try:
         self.fake_stacks[stack_id].parameters = parameters
     except KeyError:
         raise heat_exc.HTTPNotFound()
コード例 #22
0
 def test_snapshot_not_found(self):
     arglist = ['my_stack', 'snapshot_id']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.stack_client.snapshot_show = mock.Mock(
         side_effect=heat_exc.HTTPNotFound())
     self.assertRaises(exc.CommandError, self.cmd.take_action, parsed_args)
コード例 #23
0
 def test_event_show_stack_not_found(self):
     error = 'Stack not found'
     self.stack_client.get = mock.MagicMock(
         side_effect=exc.HTTPNotFound(error))
     self._test_not_found(error)
コード例 #24
0
 def side_effect(*args, **kwargs):
     raise exc.HTTPNotFound()
コード例 #25
0
 def test_build_software_deployments_no_resources(self):
     resources = {}
     self.software_deployments_client.get.side_effect = exc.HTTPNotFound()
     deployments = self.cmd._build_software_deployments(resources)
     self.assertEqual({}, deployments)
コード例 #26
0
 def test_config_show_not_found(self):
     arglist = ['96dfee3f-27b7-42ae-a03e-966226871ae6']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.mock_client.software_configs.get = mock.Mock(
         side_effect=heat_exc.HTTPNotFound())
     self.assertRaises(exc.CommandError, self.cmd.take_action, parsed_args)
コード例 #27
0
ファイル: test_event.py プロジェクト: numvc/LuxoftBot
 def test_event_show_event_not_found(self):
     error = 'Event not found'
     self.stack_client.get.side_effect = exc.HTTPNotFound(error)
     self._test_not_found(error)
コード例 #28
0
 def return_not_found(*args):
     raise heat_exc.HTTPNotFound()
コード例 #29
0
 def test_deployment_config_delete_failed(self):
     arglist = ['test_deployment']
     parsed_args = self.check_parser(self.cmd, arglist, [])
     self.config_client.delete.side_effect = heat_exc.HTTPNotFound()
     self.assertIsNone(self.cmd.take_action(parsed_args))