Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion intelmq/bin/intelmqdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def main(argv=None):
try:
defaults = utils.get_global_settings()
except Exception:
defaults = {}
log_level = DEFAULT_LOGGING_LEVEL

try:
Expand All @@ -207,7 +208,6 @@ def main(argv=None):
readline.parse_and_bind("tab: complete")
readline.set_completer_delims('')

defaults = utils.get_global_settings()
runtime_config = utils.get_runtime()
pipeline_pipes = {}
logging_paths = {defaults.get('logging_path', DEFAULT_LOGGING_PATH)}
Expand Down
12 changes: 12 additions & 0 deletions intelmq/tests/bin/test_intelmqdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ def test_list_dumps_for_all_bots_from_default_log_path(self, _):
self.assertIn("0: test-1 empty file", output[1])
self.assertIn("1: test-2 empty file", output[2])

@skip_installation()
@mock.patch.object(intelmqdump, "input", return_value='q')
def test_list_dumps_when_defaults_cannot_be_loaded(self, _):
self._prepare_empty_dump('test-1')

intelmqdump.utils.get_global_settings.side_effect = OSError("missing runtime")

with mock.patch.object(intelmqdump, "DEFAULT_LOGGING_PATH", self.tmp_log_dir.name):
output = self._run_main([])

self.assertIn("0: test-1 empty file", output[1])

@skip_installation()
@mock.patch.object(intelmqdump, "input", return_value='q')
def test_list_dumps_for_all_bots_from_custom_locations(self, _):
Expand Down