@@ -1083,15 +1083,15 @@ def setUp(self):
10831083 global_group .permissions .add (global_permission )
10841084 self .global_validator_user .groups .add (global_group )
10851085
1086- file_path = os .path .join (settings .TEST_DIR , "local_unit/test.csv " )
1086+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-admin.xlsx " )
10871087 with open (file_path , "rb" ) as f :
10881088 self ._file_content = f .read ()
10891089
1090- def create_upload_file (self , filename = "test.csv " ):
1090+ def create_upload_file (self , filename = "test-admin.xlsx " ):
10911091 """
10921092 Always return a new file instance to prevent stream exhaustion.
10931093 """
1094- return SimpleUploadedFile (filename , self ._file_content , content_type = "text/csv " )
1094+ return SimpleUploadedFile (filename , self ._file_content , content_type = "text/xlsx " )
10951095
10961096 @mock .patch ("local_units.tasks.process_bulk_upload_local_unit.delay" )
10971097 def test_bulk_upload_local_unit (self , mock_delay ):
@@ -1236,16 +1236,16 @@ def setUpTestData(cls):
12361236 cls .local_unit_type = LocalUnitType .objects .create (code = 1 , name = "Administrative" )
12371237 cls .local_unit_type2 = LocalUnitType .objects .create (code = 2 , name = "Health Care" )
12381238 cls .level = LocalUnitLevel .objects .create (level = 0 , name = "National" )
1239- file_path = os .path .join (settings .TEST_DIR , "local_unit/test.csv " )
1239+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-admin.xlsx " )
12401240 with open (file_path , "rb" ) as f :
12411241 cls ._file_content = f .read ()
12421242
1243- def create_upload_file (cls , filename = "test.csv " ):
1244- return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/csv " )
1243+ def create_upload_file (cls , filename = "test-admin.xlsx " ):
1244+ return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/xlsx " )
12451245
12461246 def test_bulk_upload_with_incorrect_country (cls ):
12471247 """
1248- Test bulk upload fails when the country does not match CSV data.
1248+ Test bulk upload fails when the country does not match xlsx data.
12491249 """
12501250 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
12511251 country = cls .country1 ,
@@ -1268,13 +1268,13 @@ def test_bulk_upload_with_incorrect_country(cls):
12681268
12691269 def test_bulk_upload_with_valid_country (cls ):
12701270 """
1271- Test bulk upload succeeds when the country matches CSV data
1271+ Test bulk upload succeeds when the country matches xlsx data
12721272 """
12731273 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
12741274 country = cls .country2 , # Brazil
12751275 local_unit_type = cls .local_unit_type ,
12761276 triggered_by = cls .user ,
1277- file = cls .create_upload_file (), # CSV with Brazil rows
1277+ file = cls .create_upload_file (), # xlsx with Brazil rows
12781278 status = LocalUnitBulkUpload .Status .PENDING ,
12791279 )
12801280 runner = BaseBulkUploadLocalUnit (cls .bulk_upload )
@@ -1287,7 +1287,7 @@ def test_bulk_upload_with_valid_country(cls):
12871287
12881288 def test_bulk_upload_fails_and_delete (cls ):
12891289 """
1290- Test bulk upload fails and delete when CSV has incorrect data.
1290+ Test bulk upload fails and delete when xlsx has incorrect data.
12911291 """
12921292 LocalUnitFactory .create_batch (
12931293 5 ,
@@ -1316,7 +1316,7 @@ def test_bulk_upload_fails_and_delete(cls):
13161316
13171317 def test_bulk_upload_deletes_old_and_creates_new_local_units (cls ):
13181318 """
1319- Test bulk upload with correct CSV data.
1319+ Test bulk upload with correct data.
13201320 """
13211321 old_local_unit = LocalUnitFactory .create (
13221322 country = cls .country2 ,
@@ -1348,10 +1348,14 @@ def test_empty_administrative_file(cls):
13481348 Test bulk upload file is empty
13491349 """
13501350
1351- file_path = os .path .join (settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "local-unit-bulk-upload-template.csv" )
1351+ file_path = os .path .join (
1352+ settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "Administrative Bulk Import Template - Local Units.xlsx"
1353+ )
13521354 with open (file_path , "rb" ) as f :
13531355 file_content = f .read ()
1354- empty_file = SimpleUploadedFile (name = "local-unit-bulk-upload-template.csv" , content = file_content , content_type = "text/csv" )
1356+ empty_file = SimpleUploadedFile (
1357+ name = "Administrative Bulk Import Template - Local Units.xlsx" , content = file_content , content_type = "text/xlsx"
1358+ )
13551359 LocalUnitFactory .create_batch (
13561360 5 ,
13571361 country = cls .country2 ,
@@ -1437,16 +1441,16 @@ def setUpTestData(cls):
14371441 cls .professional_training_facilities = ProfessionalTrainingFacility .objects .create (code = 1 , name = "Nurses" )
14381442 cls .general_medical_services = GeneralMedicalService .objects .create (code = 1 , name = "Minor Trauma" )
14391443
1440- file_path = os .path .join (settings .TEST_DIR , "local_unit/test-health.csv " )
1444+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-health.xlsx " )
14411445 with open (file_path , "rb" ) as f :
14421446 cls ._file_content = f .read ()
14431447
1444- def create_upload_file (cls , filename = "test-health.csv " ):
1445- return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/csv " )
1448+ def create_upload_file (cls , filename = "test-health.xlsx " ):
1449+ return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/xlsx " )
14461450
14471451 def test_bulk_upload_health_with_incorrect_country (cls ):
14481452 """
1449- Should fail when CSV rows are not equal to bulk upload country.
1453+ Should fail when rows are not equal to bulk upload country.
14501454 """
14511455 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
14521456 country = cls .country1 ,
@@ -1546,12 +1550,12 @@ def test_empty_health_template_file(cls):
15461550 """
15471551
15481552 file_path = os .path .join (
1549- settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "local-unit-health-bulk-upload-template.csv "
1553+ settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "Health Care Bulk Import Template - Local Units.xlsx "
15501554 )
15511555 with open (file_path , "rb" ) as f :
15521556 file_content = f .read ()
15531557 empty_file = SimpleUploadedFile (
1554- name = "local-unit-health-bulk-upload-template.csv " , content = file_content , content_type = "text/csv "
1558+ name = "Health Care Bulk Import Template - Local Units.xlsx " , content = file_content , content_type = "text/xlsx "
15551559 )
15561560 health_data = HealthDataFactory .create_batch (
15571561 5 ,
0 commit comments