forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sis_pseudonym_id to enrollment object
fixes CORE-667 fixes GRADE-250 fixes GRADE-251 test plan - have a user with multiple sis pseudonyms - enroll user into courses through sis import using both sis_ids for different enrollments - each enrollment should return the correct pseudonym in grade export, Enrollment API, Section API, Submission API Change-Id: I2693851b6b65fe8266b3a4e6e8cefc30e3d6f214 Reviewed-on: https://gerrit.instructure.com/136804 Tested-by: Jenkins QA-Review: Anju Reddy <[email protected]> Reviewed-by: Cody Cutrer <[email protected]> Product-Review: Rob Orton <[email protected]>
- Loading branch information
Showing
14 changed files
with
82 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
db/migrate/20171017211555_add_sis_psuedonym_id_to_enrollments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# Copyright (C) 2017 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
class AddSisPsuedonymIdToEnrollments < ActiveRecord::Migration[5.0] | ||
tag :predeploy | ||
|
||
def change | ||
add_column :enrollments, :sis_pseudonym_id, :integer, limit: 8 | ||
add_reference :enrollments, :pseudonym, column: :sis_pseudonym_id, index: true, foreign_key: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -946,8 +946,8 @@ def create_some_group_memberships_n_stuff() | |
@user2 = user_with_managed_pseudonym(active_all: true, account: @root, name: 'James John', | ||
username: '[email protected]', sis_user_id: 'other_shard2') | ||
end | ||
allow(@account).to receive(:trusted_account_ids).and_return([@account.id, @root.id]) | ||
allow(@account).to receive(:trust_exists?).and_return(true) | ||
allow_any_instantiation_of(@account).to receive(:trusted_account_ids).and_return([@account.id, @root.id]) | ||
allow_any_instantiation_of(@account).to receive(:trust_exists?).and_return(true) | ||
@e1 = @course1.enroll_user(@user1) | ||
@course1.enroll_user(@user2) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,26 @@ def pseud_params(unique_id, account = Account.default) | |
expect(SisPseudonym.for(u, course1)).to eq @p | ||
end | ||
|
||
it "should return pseudonym for specfic enrollment" do | ||
@p = u.pseudonyms.create!(pseud_params("[email protected]")) do |x| | ||
x.workflow_state = 'active' | ||
x.sis_user_id = "user2" | ||
end | ||
@p2 = u.pseudonyms.create!(pseud_params("[email protected]")) do |x| | ||
x.workflow_state = 'active' | ||
x.sis_user_id = "user2b" | ||
end | ||
e = course1.enroll_user(u, 'StudentEnrollment', enrollment_state: 'active') | ||
e.sis_pseudonym_id = @p.id | ||
e.save! | ||
section = course1.course_sections.create | ||
e2 = course1.enroll_user(u, 'StudentEnrollment', enrollment_state: 'active', section: section, allow_multiple_enrollments: true) | ||
e2.sis_pseudonym_id = @p2.id | ||
e2.save! | ||
expect(SisPseudonym.for(u, e)).to eq @p | ||
expect(SisPseudonym.for(u, e2)).to eq @p2 | ||
end | ||
|
||
it "should find the right root account for a course" do | ||
pseudonym = account2.pseudonyms.create!(user: u, unique_id: 'user') do |p| | ||
p.sis_user_id = 'abc' | ||
|