Beispiel #1
0
    def test_raises_for_missing_context_id_param(self, lti_launch_request, jwt, user):
        del lti_launch_request.params["context_id"]

        with pytest.raises(
            MissingLTILaunchParamError,
            match="Required data param for LTI launch missing: context_id",
        ):
            lti_launches(lti_launch_request, jwt, user)
Beispiel #2
0
 def test_raises_for_tool_consumer_instance_guid_param(
     self, lti_launch_request, jwt, user
 ):
     del lti_launch_request.params["tool_consumer_instance_guid"]
     with pytest.raises(
         MissingLTILaunchParamError,
         match="Required data param for LTI launch missing: tool_consumer_instance_guid",
     ):
         lti_launches(lti_launch_request, jwt, user)
Beispiel #3
0
 def test_raises_for_missing_roles_param(
     self, lti_launch_request, module_item_configuration, jwt, user
 ):
     del lti_launch_request.params["roles"]
     with pytest.raises(
         MissingLTILaunchParamError,
         match="Required data param for LTI launch missing: roles",
     ):
         lti_launches(lti_launch_request, jwt, user)
Beispiel #4
0
    def test_raises_for_missing_oauth_consumer_key_param(
        self, lti_launch_request, jwt, user
    ):
        del lti_launch_request.params["oauth_consumer_key"]

        with pytest.raises(
            MissingLTILaunchParamError,
            match="Required data param for LTI launch missing: oauth_consumer_key",
        ):
            lti_launches(lti_launch_request, jwt, user)
Beispiel #5
0
 def test_it_renders_the_iframe_when_the_url_is_present_in_the_params(
     self, lti_launch_request, jwt, user
 ):
     lti_launch_request.params["url"] = "https://example.com"
     value = lti_launches(lti_launch_request, jwt, user)
     assert "iframe" in value.body.decode()
     assert "example.com" in value.body.decode()
Beispiel #6
0
 def test_render_unauthorized_for_students(
     self, lti_launch_request, module_item_configuration, jwt, user
 ):
     lti_launch_request.params[
         "resource_link_id"
     ] = module_item_configuration.resource_link_id
     lti_launch_request.params[
         "tool_consumer_instance_guid"
     ] = module_item_configuration.tool_consumer_instance_guid
     lti_launch_request.params["roles"] = "urn:lti:role:ims/lis/Learner"
     value = lti_launches(lti_launch_request, jwt, user)
     assert "This page has not yet been configured" in value.body.decode()
Beispiel #7
0
 def test_render_the_document_if_configured(
     self, lti_launch_request, module_item_configuration, jwt, user
 ):
     lti_launch_request.db.add(module_item_configuration)
     lti_launch_request.db.flush()
     lti_launch_request.params[
         "resource_link_id"
     ] = module_item_configuration.resource_link_id
     lti_launch_request.params[
         "tool_consumer_instance_guid"
     ] = module_item_configuration.tool_consumer_instance_guid
     value = lti_launches(lti_launch_request, jwt, user)
     assert "iframe" in value.body.decode()
     assert "example.com" in value.body.decode()
Beispiel #8
0
 def test_render_the_form_when_the_url_is_not_present_in_the_params(
     self, lti_launch_request, jwt, user
 ):
     lti_launch_request.params["resource_link_id"] = "test_link_id"
     value = lti_launches(lti_launch_request, jwt, user)
     assert "<form" in value.body.decode()