pylti / lti

Learning Tools Interoperability for Python
Other
78 stars 45 forks source link

Content item #41

Closed subssn21 closed 7 years ago

subssn21 commented 7 years ago

Here is an initial pull request for a working implementation of the Content Item Specification.

It has been successfully tested against Canvas

Fixes #39

A basic set of tests are included for the new ContentItemResponse class, they are basically a copy of the TestToolConsumer class.

There is a lot that can be done to make this code better, but the code works, and we can easily make it better as time goes on.

subssn21 commented 7 years ago

Here are the params I was using on my project to build the ContentItemResponse in case it helps anyone

content = {
    '@context': "http://purl.imsglobal.org/ctx/lti/v1/ContentItem",
    "@graph": [
        {
                "@type": "LtiLinkItem",
                "mediaType": "application/vnd.ims.lti.v1.ltilink",
                "url": self.absolute_url("/lti/course/%s/activity/%s" % (course_id, activity_id))
        }
    ]
}

params = {'lti_message_type': 'ContentItemSelection',
          'lti_version': 'LTI-1p0',
          'content_items': json.dumps(content)
          }
codecov[bot] commented 7 years ago

Codecov Report

Merging #41 into master will decrease coverage by 0.02%. The diff coverage is 87.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #41      +/-   ##
==========================================
- Coverage   82.37%   82.34%   -0.03%     
==========================================
  Files          13       15       +2     
  Lines         607      623      +16     
  Branches      110      111       +1     
==========================================
+ Hits          500      513      +13     
- Misses         79       82       +3     
  Partials       28       28
Impacted Files Coverage Δ
src/lti/contentitem_response.py 100% <100%> (ø)
src/lti/__init__.py 100% <100%> (ø) :arrow_up:
src/lti/tool_consumer.py 66.66% <100%> (-17.71%) :arrow_down:
src/lti/launch_params.py 89.85% <100%> (+0.46%) :arrow_up:
src/lti/tool_base.py 88.67% <33.33%> (-3.33%) :arrow_down:
src/lti/tool_outbound.py 88.88% <88.88%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 93b260e...39fbaff. Read the comment docs.

subssn21 commented 7 years ago

Tested Content Item Code on Moodle this morning and worked great without any changes