mock.sentinel.ret_val

Here are the examples of the python api mock.sentinel.ret_val taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

Example 1

Project: cinder Source File: test_remotefs.py
    def test_locked_volume_id_operation_exception(self):
        @remotefs.locked_volume_id_operation
        def synchronized_func(inst):
            return mock.sentinel.ret_val

        self._locked_volume_operation_test_helper(
            func=synchronized_func,
            expected_exception=exception.VolumeBackendAPIException)

Example 2

Project: bsd-cloudinit Source File: test_physical_disk.py
    def test_get_geometry_no_geom(self):
        self._test_get_geometry(_geom=None,
                                ret_val=mock.sentinel.ret_val,
                                last_error=100)

Example 3

Project: bsd-cloudinit Source File: test_physical_disk.py
Function: test_read
    def test_read(self):
        self._test_read(ret_val=mock.sentinel.ret_val)

Example 4

Project: cloudbase-init Source File: test_disk.py
Function: test_get_geometry
    def test_get_geometry(self):
        self._test_get_geometry(ret_val=mock.sentinel.ret_val)

Example 5

Project: cloudbase-init Source File: test_disk.py
Function: test_read
    def test__read(self):
        self._test__read(ret_val=mock.sentinel.ret_val)

Example 6

Project: os-win Source File: test_iscsi_utils.py
    def _get_fake_iscsi_utils_getter_func(self, func_side_effect,
                                          decorator_args,
                                          returned_element_count=None,
                                          required_buff_sz=None):
        @iscsi_utils.ensure_buff_and_retrieve_items(**decorator_args)
        def fake_func(inst, buff=None, buff_size=None,
                      element_count=None, *args, **kwargs):
            raised_exc = None
            try:
                # Those arguments will always be ULONGs, as requested
                # by the iscsidsc functions.
                self.assertIsInstance(buff_size, ctypes.c_ulong)
                self.assertIsInstance(element_count, ctypes.c_ulong)
                func_side_effect(buff=buff, buff_size_val=buff_size.value,
                                 element_count_val=element_count.value,
                                 *args, **kwargs)
            except Exception as ex:
                raised_exc = ex

            if returned_element_count:
                element_count.value = returned_element_count
            if required_buff_sz:
                buff_size.value = required_buff_sz

            if raised_exc:
                raise raised_exc
            return mock.sentinel.ret_val
        return fake_func