-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds CourseAboutPageURLRequested and LMSPageURLRequested filters
- Loading branch information
1 parent
7c00bcc
commit 8403c8b
Showing
8 changed files
with
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
""" | ||
from openedx_filters.filters import * | ||
|
||
__version__ = "1.10.0" | ||
__version__ = "1.11.0" |
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,6 @@ | ||
""" | ||
Package where events related to the ``content_authoring`` subdomain are implemented. | ||
The ``content_authoring`` subdomain corresponds to {Architecture Subdomain} defined in OEP-41. | ||
https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0041-arch-async-server-event-messaging.html | ||
""" |
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,25 @@ | ||
""" | ||
Package where filters related to the Course Authoring architectural subdomain are implemented. | ||
""" | ||
|
||
from openedx_filters.tooling import OpenEdxPublicFilter | ||
|
||
|
||
class LMSPageURLRequested(OpenEdxPublicFilter): | ||
""" | ||
Custom class used to get lms page url filters and its custom methods. | ||
""" | ||
|
||
filter_type = "org.openedx.course_authoring.lms.page.url.requested.v1" | ||
|
||
@classmethod | ||
def run_filter(cls, url, org): | ||
""" | ||
Execute a filter with the signature specified. | ||
Arguments: | ||
url (str): the URL of the page to be modified. | ||
org (str): Course org filter used as context data to get LMS configurations. | ||
""" | ||
data = super().run_pipeline(url=url, org=org) | ||
return data.get("url"), data.get("org") |
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,3 @@ | ||
""" | ||
Package where unittest for authoring subdomain filters are located. | ||
""" |
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,32 @@ | ||
""" | ||
Tests for authoring subdomain filters. | ||
""" | ||
from unittest.mock import Mock | ||
|
||
from django.test import TestCase | ||
|
||
from openedx_filters.course_authoring.filters import LMSPageURLRequested | ||
|
||
|
||
class TestCourseAuthoringFilters(TestCase): | ||
""" | ||
Test class to verify standard behavior of the filters located in rendering views. | ||
You'll find test suites for: | ||
- LMSPageURLRequested | ||
""" | ||
|
||
def test_lms_page_url_requested(self): | ||
""" | ||
Test LMSPageURLRequested filter behavior under normal conditions. | ||
Expected behavior: | ||
- The filter should return lms page url requested. | ||
""" | ||
url = Mock() | ||
org = Mock() | ||
|
||
url_result, org_result = LMSPageURLRequested.run_filter(url, org) | ||
|
||
self.assertEqual(url, url_result) | ||
self.assertEqual(org, org_result) |
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