Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iframe support to DeepLinkResource #112

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-20.04]
python: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
- uses: actions/checkout@v3.3.0
- uses: actions/setup-python@v4.5.0
with:
python-version: ${{ matrix.python }}
- run: pip install --upgrade pip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
11 changes: 11 additions & 0 deletions pylti1p3/deep_link_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DeepLinkResource:
_url: t.Optional[str] = None
_lineitem: t.Optional[LineItem] = None
_custom_params: t.Mapping[str, str] = {}
_iframe: t.Mapping[str, int] = {}
_target: str = "iframe"
_icon_url: t.Optional[str] = None

Expand Down Expand Up @@ -60,6 +61,13 @@ def set_icon_url(self, value: str) -> "DeepLinkResource":
self._icon_url = value
return self

def get_iframe(self) -> t.Mapping[str, int]:
return self._iframe

def set_iframe(self, value: t.Mapping[str, int]):
self._iframe = value
return self

def to_dict(self) -> t.Dict[str, object]:
res: t.Dict[str, object] = {
"type": self._type,
Expand Down Expand Up @@ -93,4 +101,7 @@ def to_dict(self) -> t.Dict[str, object]:
if self._icon_url:
res["icon"] = {"url": self._icon_url}

if self._iframe:
res["iframe"] = self._iframe

return res
1 change: 0 additions & 1 deletion pylti1p3/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Deployment:

_deployment_id: t.Optional[str] = None

def get_deployment_id(self) -> t.Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_deep_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_deep_link_launch_success(self):
resource = DeepLinkResource()
resource.set_url("http://lti.django.test/launch/").set_custom_params(
{"custom_param": "custom_value"}
).set_title("Test title!")
).set_title("Test title!").set_iframe({"width": 800, "height": 400})

deep_link_return_url = message_launch_data.get(
"https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings"
Expand Down
1 change: 0 additions & 1 deletion tests/test_resource_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ def _get_data_with_invalid_message(self, *args): # pylint: disable=unused-argum
return message_launch_data

def test_res_link_launch_invalid_nonce(self):

tool_conf, login_request, login_response = self._make_oidc_login()

post_data = self.post_launch_data.copy()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ deps =
mypy
parameterized
pyjwt
pylint
pylint<2.15.6
requests
requests-mock
types-requests