-
Notifications
You must be signed in to change notification settings - Fork 183
Issue/662 Add API coverage for LTI resource links #673
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
Merged
Thetwam
merged 10 commits into
ucfopen:develop
from
jsmnhou:issue/662-api-lti-resource-links
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b4be715
get_links, get_link (id), create_link initial implementation
jsmnhou 92ea372
add unittests for LTI resource links
jsmnhou 2de1083
move under "course" class, add fixtures
jsmnhou 42876bd
styling fix
jsmnhou 3e3d5ce
fix import ordering
jsmnhou 317a45f
attempt module import fix
jsmnhou 76f67ba
alphabetize function names
jsmnhou a8118ec
additional test coverage
jsmnhou dd38ca9
bruh
jsmnhou e001286
Update docs to include LTIResourceLink. Update authors and changelog
Thetwam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
from canvasapi.canvas_object import CanvasObject | ||
|
||
|
||
class LTIResourceLink(CanvasObject): | ||
def __str__(self): | ||
return "{} ({})".format(self.url, self.title) |
This file contains hidden or 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 hidden or 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 @@ | ||
=============== | ||
LTIResourceLink | ||
=============== | ||
|
||
.. autoclass:: canvasapi.lti_resource_link.LTIResourceLink | ||
:members: |
This file contains hidden or 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,49 @@ | ||
{ | ||
"create_lti_resource_link": { | ||
"method": "POST", | ||
"endpoint": "courses/1/lti_resource_links", | ||
"data": { | ||
"id": 45, | ||
"context_id": 1, | ||
"context_type": "Course", | ||
"context_external_tool_id": 1, | ||
"resource_type": "assignment", | ||
"canvas_launch_url": "https://example.instructure.com/courses/1/external_tools/retrieve?resource_link_lookup_uuid=ae43ba23-d238-49bc-ab55-ba7f79f77896", | ||
"resource_link_uuid": "ae43ba23-d238-49bc-ab55-ba7f79f77896", | ||
"lookup_uuid": "c522554a-d4be-49ef-b163-9c87fdc6ad6f", | ||
"title": "Test LTI Resource Link", | ||
"url": "https://example.com/lti/launch/content_item/123" | ||
}, | ||
"status_code": 200 | ||
}, | ||
|
||
"get_lti_resource_link": { | ||
"method": "GET", | ||
"endpoint": "courses/1/lti_resource_links/45", | ||
"data": { | ||
"id": 45, | ||
"title": "Test LTI Resource Link", | ||
"url": "https://example.com/lti/launch/content_item/123" | ||
}, | ||
"status_code": 200 | ||
}, | ||
"list_lti_resource_links": { | ||
"method": "GET", | ||
"endpoint": "courses/1/lti_resource_links", | ||
"data": [ | ||
{ | ||
"id": 45, | ||
"title": "Test LTI Resource Link" | ||
}, | ||
{ | ||
"id": 56, | ||
"title": "Test LTI Resource Link 2" | ||
}, | ||
{ | ||
"id": 67, | ||
"title": "Test LTI Resource Link 3" | ||
} | ||
], | ||
"status_code": 200 | ||
} | ||
} |
This file contains hidden or 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 hidden or 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,30 @@ | ||
import unittest | ||
|
||
import requests_mock | ||
|
||
from canvasapi import Canvas | ||
from tests import settings | ||
from tests.util import register_uris | ||
|
||
|
||
@requests_mock.Mocker() | ||
class TestLTIResourceLink(unittest.TestCase): | ||
def setUp(self): | ||
self.canvas = Canvas(settings.BASE_URL, settings.API_KEY) | ||
|
||
with requests_mock.Mocker() as m: | ||
register_uris( | ||
{ | ||
"course": ["get_by_id"], | ||
"lti_resource_link": ["get_lti_resource_link"], | ||
}, | ||
m, | ||
) | ||
|
||
self.course = self.canvas.get_course(1) | ||
self.resource_link = self.course.get_lti_resource_link(45) | ||
|
||
# __str__() | ||
def test__str__(self, m): | ||
string = str(self.resource_link) | ||
self.assertIsInstance(string, str) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.