<s> from django . core . urlresolvers import reverse <EOL> from django . test import TestCase <EOL> from huxley . utils . test import TestSchools , TestUsers <EOL> class SchoolAdminTest ( TestCase ) : <EOL> def test_info_export ( self ) : <EOL> '''<STR_LIT>''' <EOL> TestUsers . new_user ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> TestUsers . new_superuser ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> self . client . login ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> school = TestSchools . new_school ( ) <EOL> self . client . logout ( ) <EOL> self . client . login ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( response ) <EOL> header = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:Name>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> fields_csv = "<STR_LIT:U+002C>" . join ( map ( str , header ) ) + "<STR_LIT:\r\n>" <EOL> fields = [ <EOL> school . id , <EOL> school . name , <EOL> school . address , <EOL> school . city , <EOL> school . state , <EOL> school . zip_code , <EOL> school . country , <EOL> school . primary_name , <EOL> school . primary_gender , <EOL> school . primary_email , <EOL> school . primary_phone , <EOL> school . primary_type , <EOL> school . secondary_name , <EOL> school . secondary_gender , <EOL> school . secondary_email , <EOL> school . secondary_phone , <EOL> school . secondary_type , <EOL> school . program_type , <EOL> school . times_attended , <EOL> school . international , <EOL> school . waitlist , <EOL> school . beginner_delegates , <EOL> school . intermediate_delegates , <EOL> school . advanced_delegates , <EOL> school . spanish_speaking_delegates , <EOL> school . chinese_speaking_delegates , <EOL> school . registration_comments , <EOL> school . fees_owed , <EOL> school . fees_paid , <EOL> ] <EOL> fields_csv += "<STR_LIT:U+002C>" . join ( map ( str , fields ) ) <EOL> self . assertEquals ( fields_csv , response . content [ : - <NUM_LIT:2> ] ) <EOL> def test_preference_export ( self ) : <EOL> '''<STR_LIT>''' <EOL> TestUsers . new_user ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> TestUsers . new_superuser ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> self . client . login ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> school = TestSchools . new_school ( ) <EOL> self . client . logout ( ) <EOL> self . client . login ( username = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( response ) <EOL> header = [ <EOL> "<STR_LIT:Name>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> fields_csv = "<STR_LIT:U+002C>" . join ( map ( str , header ) ) + "<STR_LIT:\r\n>" <EOL> countryprefs = [ c for c in school . countrypreferences . all ( ) ] <EOL> countryprefs += [ '<STR_LIT>' ] * ( <NUM_LIT:10> - len ( countryprefs ) ) <EOL> fields = [ <EOL> school . name , <EOL> school . beginner_delegates + school . intermediate_delegates + school . advanced_delegates , <EOL> school . beginner_delegates , <EOL> school . intermediate_delegates , <EOL> school . advanced_delegates , <EOL> school . spanish_speaking_delegates , <EOL> school . chinese_speaking_delegates , ] <EOL> fields . extend ( countryprefs ) <EOL> fields . append ( school . registration_comments ) <EOL> fields_csv += "<STR_LIT:U+002C>" . join ( map ( str , fields ) ) <EOL> self . assertEquals ( fields_csv , response . content [ : - <NUM_LIT:2> ] ) </s>
