Populate root account id on roles

fixes INTEROP-5887
flag=none

Test plan
- Ensure you have a role without a root
  account id
- Run DataFixup::PopulateRootAccountIdOnModels.run
- Ensure your roles have their root account ids
  populated

Change-Id: I9fd7fa4ac40b92716b746f0e7424b85212f118ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244525
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Mysti Lilla <mysti@instructure.com>
This commit is contained in:
Mysti Lilla 2020-08-07 11:13:02 -06:00
parent a2d90267fe
commit 6b10d90197
3 changed files with 8 additions and 0 deletions

View File

@ -114,6 +114,7 @@ module DataFixup::PopulateRootAccountIdOnModels
Quizzes::QuizGroup => :quiz,
Quizzes::QuizQuestion => :quiz,
Quizzes::QuizSubmission => :quiz,
Role => :account,
RoleOverride => :account,
Rubric => :context,
RubricAssessment => :rubric,

View File

@ -878,6 +878,13 @@ describe DataFixup::PopulateRootAccountIdOnModels do
end
end
context 'with Role' do
it_behaves_like 'a datafixup that populates root_account_id' do
let(:record) { Role.create!(name: 'Hi', account: reference_record, base_role_type: 'StudentEnrollment') }
let(:reference_record) { account_model }
end
end
context 'with Score' do
it_behaves_like 'a datafixup that populates root_account_id' do
let(:record) { reference_record.scores.create! }