diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 52c48bf5..97199372 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,9 @@ Change Log Unreleased ~~~~~~~~~~ +[9.2.1] + +* Add support for either 'whitelist' or 'registry.mapping' options (whitelist introduced in v9.0.0) [9.2.0] diff --git a/event_routing_backends/__init__.py b/event_routing_backends/__init__.py index 793994cc..dbd65bc9 100644 --- a/event_routing_backends/__init__.py +++ b/event_routing_backends/__init__.py @@ -2,4 +2,4 @@ Various backends for receiving edX LMS events.. """ -__version__ = '9.2.0' +__version__ = '9.2.1' diff --git a/event_routing_backends/management/commands/helpers/queued_sender.py b/event_routing_backends/management/commands/helpers/queued_sender.py index 3e60f88c..ad9af36e 100644 --- a/event_routing_backends/management/commands/helpers/queued_sender.py +++ b/event_routing_backends/management/commands/helpers/queued_sender.py @@ -51,7 +51,7 @@ def is_known_event(self, event): """ if "name" in event: for processor in self.engine.processors: - if event["name"] in processor.registry.mapping: + if event["name"] in processor.whitelist or event["name"] in processor.registry.mapping: return True return False diff --git a/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py b/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py index 3bb47670..c6bf706e 100644 --- a/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py +++ b/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py @@ -76,6 +76,7 @@ def command_options(): "Sending to LRS!" ] }, + "registry_mapping": {"problem_check": 1}, }, # Remote file to LRS dry run no batch size { @@ -94,6 +95,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 0 batches.", ] }, + "registry_mapping": {"problem_check": 1}, }, # Remote file to LRS, default batch size { @@ -112,6 +114,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 1 batches.", ] }, + "whitelist": ["problem_check"] }, # Local file to remote file { @@ -135,6 +138,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 2 batches.", ] }, + "whitelist": ["problem_check"] }, # Remote file dry run { @@ -157,6 +161,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 0 batches.", ] }, + "whitelist": ["problem_check"] }, ] @@ -208,7 +213,8 @@ def test_transform_command(command_opts, mock_common_calls, caplog, capsys): mm2 = MagicMock() # Fake a router mapping so some events in the log are actually processed - mm2.registry.mapping = {"problem_check": 1} + mm2.registry.mapping = command_opts.pop("registry_mapping", {}) + mm2.whitelist = command_opts.pop("whitelist", []) # Fake a process response that can be serialized to json mm2.return_value = {"foo": "bar"} tracker.backends["event_transformer"].processors = [mm2]