Exemplo n.º 1
0
    def test_action_get_not_found(self, mock_find):
        mock_find.side_effect = exc.ResourceNotFound(type='action', id='Bogus')
        req = orao.ActionGetRequest(identity='Bogus')

        ex = self.assertRaises(rpc.ExpectedException, self.eng.action_get,
                               self.ctx, req.obj_to_primitive())
        self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
        mock_find.assert_called_once_with(self.ctx, 'Bogus')
Exemplo n.º 2
0
    def test_action_get(self, mock_find):
        x_obj = mock.Mock()
        mock_find.return_value = x_obj
        x_obj.to_dict.return_value = {'k': 'v'}

        req = orao.ActionGetRequest(identity='ACTION_ID')
        result = self.eng.action_get(self.ctx, req.obj_to_primitive())

        self.assertEqual({'k': 'v'}, result)
        mock_find.assert_called_once_with(self.ctx, 'ACTION_ID')
Exemplo n.º 3
0
 def test_action_get_request(self):
     sot = actions.ActionGetRequest(**self.body)
     self.assertEqual('test-action', sot.identity)