示例#1
0
 def test_get_objects(self):
     objs = self._test_class.get_objects(self.context)
     self.get_objects_mock.assert_any_call(
         self._test_class, self.context, _pager=None)
     self.assertItemsEqual(
         [test_base.get_obj_persistent_fields(obj) for obj in self.objs],
         [test_base.get_obj_persistent_fields(obj) for obj in objs])
示例#2
0
 def test_get_objects(self):
     admin_context = self.context.elevated()
     with mock.patch.object(self.context, 'elevated',
                            return_value=admin_context) as context_mock:
         objs = self._test_class.get_objects(self.context)
     context_mock.assert_called_once_with()
     self.get_objects_mock.assert_any_call(
         admin_context, self._test_class.db_model, _pager=None)
     self.assertItemsEqual(
         [test_base.get_obj_persistent_fields(obj) for obj in self.objs],
         [test_base.get_obj_persistent_fields(obj) for obj in objs])
示例#3
0
 def test_get_objects(self):
     admin_context = self.context.elevated()
     with mock.patch.object(self.context, 'elevated',
                            return_value=admin_context) as context_mock:
         objs = self._test_class.get_objects(self.context)
     context_mock.assert_called_once_with()
     self.get_objects_mock.assert_any_call(
         self._test_class, admin_context, _pager=None)
     self.assertItemsEqual(
         [test_base.get_obj_persistent_fields(obj) for obj in self.objs],
         [test_base.get_obj_persistent_fields(obj) for obj in objs])