-
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
e7647e2
commit 7a594a9
Showing
6 changed files
with
110 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
Package where filters related to the authoring subdomain are implemented. | ||
The authoring subdomain corresponds to {Architecture Subdomain} defined in | ||
the OEP-41. | ||
""" |
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,26 @@ | ||
""" | ||
Package where filters related to the authoring architectural subdomain are implemented. | ||
""" | ||
|
||
from openedx_filters.exceptions import OpenEdxFilterException | ||
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.authoring.lms.page.url.requested.v1" | ||
|
||
@classmethod | ||
def run_filter(cls, target_url, org): | ||
""" | ||
Execute a filter with the signature specified. | ||
Arguments: | ||
target_url (str): target url to use. | ||
org (str): Course org filter, this value will be used to filter out the correct lms url configuration. | ||
""" | ||
data = super().run_pipeline(target_url=target_url, org=org) | ||
return data.get("target_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 ddt import data, ddt, unpack | ||
from django.test import TestCase | ||
|
||
from openedx_filters.authoring.filters import LMSPageURLRequested | ||
|
||
|
||
@ddt | ||
class TestAuthoringFilters(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. | ||
""" | ||
target_url = Mock() | ||
org = Mock() | ||
|
||
result = LMSPageURLRequested.run_filter(target_url, org) | ||
|
||
self.assertEqual((target_url, 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