Skip to content

Commit

Permalink
Fix backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-certat committed Sep 28, 2023
1 parent fa8f6be commit 4181701
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion intelmq/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def _get_console_entry_points():
def get_bot_module_name(bot_name: str) -> str:
entries = entry_points()
if hasattr(entries, "select"):
entries = entries.select(name=bot_name, group="console_scripts")
entries = tuple(entries.select(name=bot_name, group="console_scripts"))
else:
entries = [entry for entry in entries.get("console_scripts", []) if entry.name == bot_name]

Expand Down
2 changes: 2 additions & 0 deletions intelmq/tests/lib/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ def test_get_bot_module_name_builtin_bot(self):
found_name = utils.get_bot_module_name("intelmq.bots.collectors.api.collector_api")
self.assertEqual("intelmq.bots.collectors.api.collector_api", found_name)

self.assertIsNone(utils.get_bot_module_name("intelmq.not-existing-bot"))

def test_get_bots_settings(self):
with unittest.mock.patch.object(utils, "get_runtime", new_get_runtime):
runtime = utils.get_bots_settings()
Expand Down

0 comments on commit 4181701

Please sign in to comment.