def test_get_dependent_resources(self, mock_server_list):
        plugin = ServerProtectablePlugin(self._context)

        server_info = collections.namedtuple('server_info', ['id', 'name'])
        mock_server_list.return_value = [
            server_info(id='123', name='name123'),
            server_info(id='456', name='name456')]
        self.assertEqual([Resource('OS::Nova::Server', '123', 'name123'),
                          Resource('OS::Nova::Server', '456', 'name456')],
                         plugin.get_dependent_resources(self._context, None))
Ejemplo n.º 2
0
    def test_get_dependent_resources(self, mock_server_list,
                                     mock_generate_session):
        plugin = ServerProtectablePlugin(self._context)
        mock_generate_session.return_value = keystone_session.Session(
            auth=None)

        server_info = collections.namedtuple('server_info',
                                             ['id', 'name', 'status'])
        mock_server_list.return_value = [
            server_info(id='123', name='name123', status='ACTIVE'),
            server_info(id='456', name='name456', status='ACTIVE')
        ]
        self.assertEqual([
            Resource('OS::Nova::Server', '123', 'name123'),
            Resource('OS::Nova::Server', '456', 'name456')
        ], plugin.get_dependent_resources(self._context, None))