fix case sensitivity in sis headers
test plan: * import a csv file with all-caps headers * it should still work Change-Id: Ifeac18095e742e974f3709915d6d21f8c5d2d11a Reviewed-on: https://gerrit.instructure.com/11206 Reviewed-by: Simon Williams <simon@instructure.com> Tested-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
1a4359309e
commit
ca2947cad3
|
@ -397,6 +397,7 @@ module SIS
|
|||
end
|
||||
begin
|
||||
FasterCSV.foreach(csv[:fullpath], BaseImporter::PARSE_ARGS.merge(:headers => false)) do |row|
|
||||
row.each(&:downcase!)
|
||||
importer = IMPORTERS.index do |importer|
|
||||
if SIS::CSV.const_get(importer.to_s.camelcase + 'Importer').send('is_' + importer.to_s + '_csv?', row)
|
||||
@csvs[importer] << csv
|
||||
|
|
|
@ -140,4 +140,18 @@ describe SIS::CSV::AccountImporter do
|
|||
Account.find_by_sis_source_id('A001').name.should == "Science"
|
||||
end
|
||||
|
||||
it 'should match headers case-insensitively' do
|
||||
before_count = Account.count
|
||||
process_csv_data_cleanly(
|
||||
"Account_ID,Parent_Account_ID,Name,Status",
|
||||
"A001,,Humanities,active"
|
||||
)
|
||||
Account.count.should == before_count + 1
|
||||
|
||||
a1 = @account.sub_accounts.find_by_sis_source_id('A001')
|
||||
a1.should_not be_nil
|
||||
a1.parent_account_id.should == @account.id
|
||||
a1.root_account_id.should == @account.id
|
||||
a1.name.should == 'Humanities'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue