-
Notifications
You must be signed in to change notification settings - Fork 14
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
Basic functional test for DeepLinking launches #6918
Conversation
de6303c
to
dc7db58
Compare
@@ -84,13 +83,6 @@ def test_basic_lti_launch_canvas_deep_linking_canvas_file( | |||
== 1 | |||
) | |||
|
|||
@pytest.fixture(autouse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to conftest.py
@@ -104,12 +96,6 @@ def assignment(self, db_session, application_instance, lti_params): | |||
|
|||
return assignment | |||
|
|||
@pytest.fixture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, moved to conftest.py
}, | ||
**kwargs, | ||
) | ||
return functools.partial(_lti_v11_launch, app, "/lti_launches") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this fixture a bit to be able to reuse it for deep linking launches.
|
||
|
||
@pytest.fixture | ||
def application_instance(db_session): # noqa: ARG001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common fixtures between basic launch and deep linking launch moved here.
@@ -25,6 +29,14 @@ | |||
) | |||
|
|||
|
|||
@pytest.fixture | |||
def environ(): | |||
environ = dict(os.environ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixture to make easier to access the os.environ version that contains all TEST_ENVIROMENT values.
@@ -23,33 +21,35 @@ def test_requests_with_no_oauth_signature_are_forbidden( | |||
assert response.headers["Content-Type"] == Any.string.matching("^text/html") | |||
assert response.html | |||
|
|||
def test_unconfigured_basic_lti_launch(self, lti_params, do_lti_launch): | |||
def test_unconfigured_basic_lti_launch( | |||
self, lti_params, do_lti_launch, get_client_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes to accommodate get_client_config being now a fixture instead of a local function.
get_client_config, | ||
environ, | ||
): | ||
response = do_deep_link_launch(post_params=lti_params, status=200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very simple test, similar to the basic launch ones.
Make a request, assert the contents of the response's config.
@@ -26,6 +26,7 @@ | |||
"h_api_url_private": "https://h.example.com/private/api/", | |||
"rpc_allowed_origins": ["http://localhost:5000"], | |||
"oauth2_state_secret": "test_oauth2_state_secret", | |||
"onedrive_client_id": "test_one_drive_client_id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing setting on the tests fixture.
dc7db58
to
905292c
Compare
905292c
to
12ab463
Compare
LGTM 👍 |
Just covering the LTI1.1 version on this commit.
Add a basic functional test for the LTI1.1 deep linking launch.
This is similar to the existing basic LTI launch test so there's some fixtures that are moved around and refactored to be able to reuse them in both cases.
This only cover the launch side of DeepLinking and the intention is just to have a sanity check type of test. In a follow up PR I'll add test for the API side of deep linking.