Skip to content

Commit

Permalink
Merge branch 'main' into jipm/add_tenant_aware_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored Sep 23, 2024
2 parents e95d591 + 6a2c8c4 commit d89aac4
Show file tree
Hide file tree
Showing 20 changed files with 219 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ updates:
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8', '3.11']
os: [ubuntu-latest]
python-version: ['3.11']
toxenv: ["django42", "quality", "docs"]

steps:
Expand All @@ -37,7 +37,7 @@ jobs:
run: tox

- name: Run coverage
if: matrix.python-version == '3.8' && matrix.toxenv == 'django42'
if: matrix.python-version == '3.11' && matrix.toxenv == 'django42'
uses: codecov/codecov-action@v4
with:
flags: unittests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
jobs:

push:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

- name: Install pip
run: pip install -r requirements/pip.txt
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: "ubuntu-22.04"
tools:
python: "3.8"
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""
from openedx_filters.filters import *

__version__ = "1.9.0"
__version__ = "1.10.0"
19 changes: 19 additions & 0 deletions openedx_filters/learning/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
24 changes: 24 additions & 0 deletions openedx_filters/learning/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
CourseRunAPIRenderStarted,
CourseUnenrollmentStarted,
DashboardRenderStarted,
IDVPageURLRequested,
InstructorDashboardRenderStarted,
ORASubmissionViewRenderStarted,
RenderXBlockStarted,
Expand Down Expand Up @@ -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)
18 changes: 3 additions & 15 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ persistent = yes
load-plugins = edx_lint.pylint,pylint_celery

[MESSAGES CONTROL]
enable =
enable =
blacklisted-name,
line-too-long,

abstract-class-instantiated,
abstract-method,
access-member-before-definition,
Expand Down Expand Up @@ -184,26 +183,21 @@ enable =
used-before-assignment,
using-constant-test,
yield-outside-function,

astroid-error,
fatal,
method-check-failed,
parse-error,
raw-checker-failed,

empty-docstring,
invalid-characters-in-docstring,
missing-docstring,
wrong-spelling-in-comment,
wrong-spelling-in-docstring,

unused-argument,
unused-import,
unused-variable,

eval-used,
exec-used,

bad-classmethod-argument,
bad-mcs-classmethod-argument,
bad-mcs-method-argument,
Expand Down Expand Up @@ -234,30 +228,25 @@ enable =
unneeded-not,
useless-else-on-loop,
wrong-assert-type,

deprecated-method,
deprecated-module,

too-many-boolean-expressions,
too-many-nested-blocks,
too-many-statements,

wildcard-import,
wrong-import-order,
wrong-import-position,

missing-final-newline,
mixed-line-endings,
trailing-newlines,
trailing-whitespace,
unexpected-line-ending-format,

bad-inline-option,
bad-option-value,
deprecated-pragma,
unrecognized-inline-option,
useless-suppression,
disable =
disable =
bad-indentation,
consider-using-f-string,
duplicate-code,
Expand All @@ -277,14 +266,13 @@ disable =
too-many-locals,
too-many-public-methods,
too-many-return-statements,
too-many-positional-arguments,
ungrouped-imports,
unspecified-encoding,
unused-wildcard-import,
use-maxsplit-arg,

feature-toggle-needs-doc,
illegal-waffle-usage,

logging-fstring-interpolation,

[REPORTS]
Expand Down
12 changes: 3 additions & 9 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# make upgrade
#
asgiref==3.8.1
# via django
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# django
django==4.2.13
django==4.2.16
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/base.in
sqlparse==0.5.0
sqlparse==0.5.1
# via django
typing-extensions==4.12.2
# via asgiref
18 changes: 7 additions & 11 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# make upgrade
#
cachetools==5.3.3
cachetools==5.5.0
# via tox
chardet==5.2.0
# via tox
colorama==0.4.6
# via tox
distlib==0.3.8
# via virtualenv
filelock==3.15.4
filelock==3.16.1
# via
# tox
# virtualenv
packaging==24.1
# via
# pyproject-api
# tox
platformdirs==4.2.2
platformdirs==4.3.6
# via
# tox
# virtualenv
pluggy==1.5.0
# via tox
pyproject-api==1.7.1
pyproject-api==1.8.0
# via tox
tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.15.1
tox==4.20.0
# via -r requirements/ci.in
virtualenv==20.26.3
virtualenv==20.26.5
# via tox
3 changes: 0 additions & 3 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@

# Common constraints for edx repos
-c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt

# Temporary to Support the python 3.11 Upgrade
backports.zoneinfo;python_version<"3.9" # Newer versions have zoneinfo available in the standard library
Loading

0 comments on commit d89aac4

Please sign in to comment.