From 537146b11cfbb741211cd5267b7333071aec335b Mon Sep 17 00:00:00 2001 From: Paul Kerschen Date: Mon, 22 May 2017 13:17:19 -0700 Subject: [PATCH] COL-927 Distinguish courses with same Canvas id in different instances --- node_modules/col-course/lib/api.js | 4 ++-- node_modules/col-lti/tests/test-lti.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/node_modules/col-course/lib/api.js b/node_modules/col-course/lib/api.js index 9a88fe04..35c4009f 100644 --- a/node_modules/col-course/lib/api.js +++ b/node_modules/col-course/lib/api.js @@ -84,10 +84,10 @@ var getOrCreateCourse = module.exports.getOrCreateCourse = function(canvasCourse // Get the course from the DB or create it if it doesn't exist yet options = { 'where': { - 'canvas_course_id': canvasCourseId + 'canvas_course_id': canvasCourseId, + 'canvas_api_domain': canvas.canvas_api_domain }, 'defaults': { - 'canvas_api_domain': canvas.canvas_api_domain, 'name': courseInfo.name, 'assetlibrary_url': courseInfo.assetlibrary_url, 'dashboard_url': courseInfo.dashboard_url, diff --git a/node_modules/col-lti/tests/test-lti.js b/node_modules/col-lti/tests/test-lti.js index 57da72b9..3db648e5 100644 --- a/node_modules/col-lti/tests/test-lti.js +++ b/node_modules/col-lti/tests/test-lti.js @@ -275,7 +275,18 @@ describe('LTI', function() { TestsUtil.getAssetLibraryClient(null, null, userA, function(client, courseB, userA) { UsersTestsUtil.assertGetMe(client, courseB, null, function(meNewCourse) { assert.notEqual(meNewCourse.course.id, me.course.id); - return callback(); + + // Launching the tool for a different user in a different Canvas instance with the same + // Canvas course id should result in a new Collabosphere course + var davisCourse = TestsUtil.generateCourse(global.tests.canvas.ucdavis, me.course.canvas_course_id); + TestsUtil.getAssetLibraryClient(null, davisCourse, null, function(davisClient, davisCourse, davisUser) { + UsersTestsUtil.assertGetMe(davisClient, davisCourse, null, function(davisMe) { + assert.notEqual(me.course.id, davisMe.course.id); + assert.notEqual(me.course.canvas_api_domain, davisMe.course.canvas_api_domain); + + return callback(); + }); + }); }); }); });