diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8541c005..40ec1ed1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,14 @@ Unreleased ---------- * Configuration for automatic filters docs generation. +[1.10.0] - 2024-09-20 +-------------------- + +Added +~~~~~ + +* IDVPageURLRequested filter added which can be used to modify the URL for the ID verification process. + [1.9.0] - 2024-06-14 -------------------- diff --git a/openedx_filters/__init__.py b/openedx_filters/__init__.py index 835c5d54..fd050254 100644 --- a/openedx_filters/__init__.py +++ b/openedx_filters/__init__.py @@ -3,4 +3,4 @@ """ from openedx_filters.filters import * -__version__ = "1.9.0" +__version__ = "1.10.0" diff --git a/openedx_filters/learning/filters.py b/openedx_filters/learning/filters.py index f95e4f82..dc39b8db 100644 --- a/openedx_filters/learning/filters.py +++ b/openedx_filters/learning/filters.py @@ -779,3 +779,22 @@ def run_filter(cls, context: dict, template_name: str): """ data = super().run_pipeline(context=context, template_name=template_name, ) return data.get("context"), data.get("template_name") + + +class IDVPageURLRequested(OpenEdxPublicFilter): + """ + Custom class used to create filters to act on ID verification page URL requests. + """ + + filter_type = "org.openedx.learning.idv.page.url.requested.v1" + + @classmethod + def run_filter(cls, url: str): + """ + Execute a filter with the specified signature. + + Arguments: + url (str): The url for the ID verification page to be modified. + """ + data = super().run_pipeline(url=url) + return data.get("url") diff --git a/openedx_filters/learning/tests/test_filters.py b/openedx_filters/learning/tests/test_filters.py index 9021906b..203728cf 100644 --- a/openedx_filters/learning/tests/test_filters.py +++ b/openedx_filters/learning/tests/test_filters.py @@ -20,6 +20,7 @@ CourseRunAPIRenderStarted, CourseUnenrollmentStarted, DashboardRenderStarted, + IDVPageURLRequested, InstructorDashboardRenderStarted, ORASubmissionViewRenderStarted, RenderXBlockStarted, @@ -728,3 +729,26 @@ def test_course_run_api_render_started(self): result = CourseRunAPIRenderStarted.run_filter(serialized_courserun) self.assertEqual(serialized_courserun, result) + + +class TestIDVFilters(TestCase): + """ + Test class to verify standard behavior of the ID verification filters. + You'll find test suites for: + + - IDVPageURLRequested + """ + + def test_idv_page_url_requested(self): + """ + Test IDVPageURLRequested filter behavior under normal conditions. + + Expected behavior: + - The filter must have the signature specified. + - The filter should return the url. + """ + url = Mock() + + result = IDVPageURLRequested.run_filter(url) + + self.assertEqual(url, result)