def test_debug_log_filter_cmd(self, monkeypatch, logger, category, logged_before, logged_after): """Test the :debug-log-filter command handler.""" logfilter = log.LogFilter(["init"]) monkeypatch.setattr(log, 'console_filter', logfilter) record = self._make_record(logger, category) assert logfilter.filter(record) == logged_before utilcmds.debug_log_filter('url,js') assert logfilter.filter(record) == logged_after
def test_debug_log_filter_cmd(self, monkeypatch, logger, category, logged_before, logged_after): """Test the :debug-log-filter command handler.""" logfilter = log.LogFilter(["init"]) monkeypatch.setattr(log, 'console_filter', logfilter) record = self._make_record(logger, category) assert logfilter.filter(record) == logged_before utilcmds.debug_log_filter('url,js') assert logfilter.filter(record) == logged_after
def test_debug_log_filter_cmd_invalid(self, monkeypatch): logfilter = log.LogFilter(set()) monkeypatch.setattr(log, 'console_filter', logfilter) with pytest.raises(cmdutils.CommandError, match='Invalid log category blabla'): utilcmds.debug_log_filter('blabla')