def test_inotify_config(self, mock_config):
        """
        test each case of is_inotify_config()

        :param mock_config: mock_config.__getitem__.return_value.get_int.return_value mocks out
        the value of use_notify in is_inotify_config()
        :return:
        """
        mock_config.__getitem__.return_value.get_int.return_value = True
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.side_effect = ValueError("bees?")
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.side_effect = configparser.Error
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.return_value = None
        self.assertTrue(file_monitor.is_inotify_config())
Exemple #2
0
    def test_inotify_config(self, mock_config):
        """
        test each case of is_inotify_config()

        :param mock_config: mock_config.__getitem__.return_value.get_int.return_value mocks out
        the value of use_notify in is_inotify_config()
        :return:
        """
        mock_config.__getitem__.return_value.get_int.return_value = True
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.side_effect = ValueError("bees?")
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.side_effect = configparser.Error
        self.assertTrue(file_monitor.is_inotify_config())
        mock_config.__getitem__.return_value.get_int.return_value = None
        self.assertTrue(file_monitor.is_inotify_config())