Пример #1
0
    def test_node_check2_not_found(self, mock_find):
        mock_find.side_effect = exc.ResourceNotFound(type='node', id='Bogus')

        req = orno.NodeCheckRequest(identity='Bogus')
        ex = self.assertRaises(rpc.ExpectedException, self.eng.node_check2,
                               self.ctx, req.obj_to_primitive())

        self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
        self.assertEqual('The node (Bogus) could not be found.',
                         six.text_type(ex.exc_info[1]))
        mock_find.assert_called_once_with(self.ctx, 'Bogus')
Пример #2
0
    def test_node_check(self, mock_find, mock_action, mock_start):
        mock_find.return_value = mock.Mock(id='12345678AB')
        mock_action.return_value = 'ACTION_ID'

        params = {'k1': 'v1'}
        req = orno.NodeCheckRequest(identity='FAKE_NODE', params=params)
        result = self.eng.node_check(self.ctx, req.obj_to_primitive())

        self.assertEqual({'action': 'ACTION_ID'}, result)
        mock_find.assert_called_once_with(self.ctx, 'FAKE_NODE')
        mock_action.assert_called_once_with(
            self.ctx, '12345678AB', consts.NODE_CHECK,
            name='node_check_12345678',
            cause=consts.CAUSE_RPC,
            status=action_mod.Action.READY,
            inputs={'k1': 'v1'})
        mock_start.assert_called_once_with()
Пример #3
0
 def test_node_check_request(self):
     sot = nodes.NodeCheckRequest(**self.body)
     self.assertEqual({'foo': 'bar'}, sot.params)