@@ -2117,6 +2117,58 @@ def check_section_not_crosslisted
21172117 check_section_not_crosslisted
21182118 end
21192119
2120+ it 'should leave a section alone if a section has been decrosslisted manually' do
2121+ process_csv_data_cleanly (
2122+ "course_id,short_name,long_name,account_id,term_id,status" ,
2123+ "C001,TC 101,Test Course 101,,,active" ,
2124+ "C002,TC 102,Test Course 102,,,active" ,
2125+ "C003,TC 103,Test Course 103,,,active"
2126+ )
2127+ process_csv_data_cleanly (
2128+ "section_id,course_id,name,start_date,end_date,status" ,
2129+ "S001,C001,Sec1,2011-1-05 00:00:00,2011-4-14 00:00:00,active"
2130+ )
2131+
2132+ def with_section ( &block )
2133+ CourseSection . find_by_root_account_id_and_sis_source_id ( @account . id , 'S001' ) . tap ( &block )
2134+ end
2135+ def check_section_crosslisted ( sis_id )
2136+ with_section do |s |
2137+ s . course . sis_source_id . should == sis_id
2138+ s . nonxlist_course . sis_source_id . should == 'C001'
2139+ end
2140+ end
2141+ def check_section_not_crosslisted
2142+ with_section do |s |
2143+ s . course . sis_source_id . should == 'C001'
2144+ s . nonxlist_course . should be_nil
2145+ end
2146+ end
2147+
2148+ check_section_not_crosslisted
2149+ process_csv_data_cleanly (
2150+ "xlist_course_id,section_id,status" ,
2151+ "C002,S001,active"
2152+ )
2153+ check_section_crosslisted 'C002'
2154+ with_section { |s | s . uncrosslist }
2155+ check_section_not_crosslisted
2156+ process_csv_data_cleanly (
2157+ "xlist_course_id,section_id,status" ,
2158+ "C002,S001,active"
2159+ )
2160+ with_section do |s |
2161+ s . clear_sis_stickiness :course_id
2162+ s . save!
2163+ end
2164+ check_section_not_crosslisted
2165+ process_csv_data_cleanly (
2166+ "xlist_course_id,section_id,status" ,
2167+ "C002,S001,active"
2168+ )
2169+ check_section_crosslisted 'C002'
2170+ end
2171+
21202172 end
21212173
21222174 context 'grade publishing results importing' do
0 commit comments