Skip to content

Commit

Permalink
Add tests to verify the presence of new roles and pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kosub committed Sep 9, 2014
1 parent 83a207f commit d94559c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/Provider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,23 @@ describe 'LTI.Provider', () ->
body:
roles: 'Instructor,Administrator'

provider.instructor.should.equal true
it 'should handle different role types from the specification', () =>
provider = new @lti.Provider('key', 'secret')
provider.parse_request
body:
roles: 'urn:lti:role:ims/lis/Student,urn:lti:sysrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Alumni'

provider.student.should.equal true
provider.admin.should.equal true
provider.alumni.should.equal true

it 'should handle garbage roles that do not match the specification', () =>
provider = new @lti.Provider('key', 'secret')
provider.parse_request
body:
roles: 'urn:lti::ims/lis/Student,urn:lti:sysrole:ims/lis/Administrator/,/Alumni'

provider.student.should.equal false
provider.admin.should.equal false
provider.alumni.should.equal false

0 comments on commit d94559c

Please sign in to comment.