-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds xApiTransforms for completion aggregator events
* adds dependency on edx-event-routing-backends * adds transformers to xapi.completion and xapi.progress * adds the completion_aggregator events to the event tracking whitelist
- Loading branch information
1 parent
4a229fd
commit 7652429
Showing
5 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Test the aggregator plugin settings. | ||
""" | ||
from event_routing_backends.settings import common as erb_settings | ||
|
||
from django.conf import settings | ||
|
||
from completion_aggregator.settings import common as common_settings | ||
|
||
|
||
def test_event_tracking_backends(): | ||
""" | ||
Test that the completion aggregator events are whitelisted on the ERB backends. | ||
""" | ||
# Event Routing Backend settings must be loaded first. | ||
erb_settings.plugin_settings(settings) | ||
common_settings.plugin_settings(settings) | ||
|
||
transformer_options = settings.EVENT_TRACKING_BACKENDS['event_transformer']['OPTIONS'] | ||
toplevel_whitelist = set(transformer_options['processors'][0]['OPTIONS']['whitelist']) | ||
xapi_whitelist = set(transformer_options['backends']['xapi']['OPTIONS']['processors'][0]['OPTIONS']['whitelist']) | ||
|
||
assert toplevel_whitelist, "No whitelist found in event_transformer processors?" | ||
assert xapi_whitelist, "No whitelist found in event_transformer processors?" | ||
|
||
expected_events = { | ||
'openedx.completion_aggregator.progress.course', | ||
'openedx.completion_aggregator.progress.chapter', | ||
'openedx.completion_aggregator.progress.sequential', | ||
'openedx.completion_aggregator.progress.vertical', | ||
'openedx.completion_aggregator.completion.course', | ||
'openedx.completion_aggregator.completion.chapter', | ||
'openedx.completion_aggregator.completion.sequential', | ||
'openedx.completion_aggregator.completion.vertical', | ||
} | ||
|
||
# Ensure expected_events is a subset of these whitelists | ||
assert expected_events < toplevel_whitelist, "Aggregator events not found in event_transformer whitelist" | ||
assert expected_events < xapi_whitelist, "Aggregator events not found in xapi whitelist" |