@@ -1177,15 +1177,15 @@ def setUp(self):
11771177 global_group .permissions .add (global_permission )
11781178 self .global_validator_user .groups .add (global_group )
11791179
1180- file_path = os .path .join (settings .TEST_DIR , "local_unit/test.csv " )
1180+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-admin.xlsx " )
11811181 with open (file_path , "rb" ) as f :
11821182 self ._file_content = f .read ()
11831183
1184- def create_upload_file (self , filename = "test.csv " ):
1184+ def create_upload_file (self , filename = "test-admin.xlsx " ):
11851185 """
11861186 Always return a new file instance to prevent stream exhaustion.
11871187 """
1188- return SimpleUploadedFile (filename , self ._file_content , content_type = "text/csv " )
1188+ return SimpleUploadedFile (filename , self ._file_content , content_type = "text/xlsx " )
11891189
11901190 @mock .patch ("local_units.tasks.process_bulk_upload_local_unit.delay" )
11911191 def test_bulk_upload_local_unit (self , mock_delay ):
@@ -1330,16 +1330,16 @@ def setUpTestData(cls):
13301330 cls .local_unit_type = LocalUnitType .objects .create (code = 1 , name = "Administrative" )
13311331 cls .local_unit_type2 = LocalUnitType .objects .create (code = 2 , name = "Health Care" )
13321332 cls .level = LocalUnitLevel .objects .create (level = 0 , name = "National" )
1333- file_path = os .path .join (settings .TEST_DIR , "local_unit/test.csv " )
1333+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-admin.xlsx " )
13341334 with open (file_path , "rb" ) as f :
13351335 cls ._file_content = f .read ()
13361336
1337- def create_upload_file (cls , filename = "test.csv " ):
1338- return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/csv " )
1337+ def create_upload_file (cls , filename = "test-admin.xlsx " ):
1338+ return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/xlsx " )
13391339
13401340 def test_bulk_upload_with_incorrect_country (cls ):
13411341 """
1342- Test bulk upload fails when the country does not match CSV data.
1342+ Test bulk upload fails when the country does not match xlsx data.
13431343 """
13441344 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
13451345 country = cls .country1 ,
@@ -1362,13 +1362,13 @@ def test_bulk_upload_with_incorrect_country(cls):
13621362
13631363 def test_bulk_upload_with_valid_country (cls ):
13641364 """
1365- Test bulk upload succeeds when the country matches CSV data
1365+ Test bulk upload succeeds when the country matches xlsx data
13661366 """
13671367 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
13681368 country = cls .country2 , # Brazil
13691369 local_unit_type = cls .local_unit_type ,
13701370 triggered_by = cls .user ,
1371- file = cls .create_upload_file (), # CSV with Brazil rows
1371+ file = cls .create_upload_file (), # xlsx with Brazil rows
13721372 status = LocalUnitBulkUpload .Status .PENDING ,
13731373 )
13741374 runner = BaseBulkUploadLocalUnit (cls .bulk_upload )
@@ -1381,7 +1381,7 @@ def test_bulk_upload_with_valid_country(cls):
13811381
13821382 def test_bulk_upload_fails_and_delete (cls ):
13831383 """
1384- Test bulk upload fails and delete when CSV has incorrect data.
1384+ Test bulk upload fails and delete when xlsx has incorrect data.
13851385 """
13861386 LocalUnitFactory .create_batch (
13871387 5 ,
@@ -1410,7 +1410,7 @@ def test_bulk_upload_fails_and_delete(cls):
14101410
14111411 def test_bulk_upload_deletes_old_and_creates_new_local_units (cls ):
14121412 """
1413- Test bulk upload with correct CSV data.
1413+ Test bulk upload with correct data.
14141414 """
14151415 old_local_unit = LocalUnitFactory .create (
14161416 country = cls .country2 ,
@@ -1442,10 +1442,14 @@ def test_empty_administrative_file(cls):
14421442 Test bulk upload file is empty
14431443 """
14441444
1445- file_path = os .path .join (settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "local-unit-bulk-upload-template.csv" )
1445+ file_path = os .path .join (
1446+ settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "Administrative Bulk Import Template - Local Units.xlsx"
1447+ )
14461448 with open (file_path , "rb" ) as f :
14471449 file_content = f .read ()
1448- empty_file = SimpleUploadedFile (name = "local-unit-bulk-upload-template.csv" , content = file_content , content_type = "text/csv" )
1450+ empty_file = SimpleUploadedFile (
1451+ name = "Administrative Bulk Import Template - Local Units.xlsx" , content = file_content , content_type = "text/xlsx"
1452+ )
14491453 LocalUnitFactory .create_batch (
14501454 5 ,
14511455 country = cls .country2 ,
@@ -1531,16 +1535,16 @@ def setUpTestData(cls):
15311535 cls .professional_training_facilities = ProfessionalTrainingFacility .objects .create (code = 1 , name = "Nurses" )
15321536 cls .general_medical_services = GeneralMedicalService .objects .create (code = 1 , name = "Minor Trauma" )
15331537
1534- file_path = os .path .join (settings .TEST_DIR , "local_unit/test-health.csv " )
1538+ file_path = os .path .join (settings .TEST_DIR , "local_unit/test-health.xlsx " )
15351539 with open (file_path , "rb" ) as f :
15361540 cls ._file_content = f .read ()
15371541
1538- def create_upload_file (cls , filename = "test-health.csv " ):
1539- return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/csv " )
1542+ def create_upload_file (cls , filename = "test-health.xlsx " ):
1543+ return SimpleUploadedFile (filename , cls ._file_content , content_type = "text/xlsx " )
15401544
15411545 def test_bulk_upload_health_with_incorrect_country (cls ):
15421546 """
1543- Should fail when CSV rows are not equal to bulk upload country.
1547+ Should fail when rows are not equal to bulk upload country.
15441548 """
15451549 cls .bulk_upload = LocalUnitBulkUploadFactory .create (
15461550 country = cls .country1 ,
@@ -1640,12 +1644,12 @@ def test_empty_health_template_file(cls):
16401644 """
16411645
16421646 file_path = os .path .join (
1643- settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "local-unit-health-bulk-upload-template.csv "
1647+ settings .STATICFILES_DIRS [0 ], "files" , "local_units" , "Health Care Bulk Import Template - Local Units.xlsx "
16441648 )
16451649 with open (file_path , "rb" ) as f :
16461650 file_content = f .read ()
16471651 empty_file = SimpleUploadedFile (
1648- name = "local-unit-health-bulk-upload-template.csv " , content = file_content , content_type = "text/csv "
1652+ name = "Health Care Bulk Import Template - Local Units.xlsx " , content = file_content , content_type = "text/xlsx "
16491653 )
16501654 health_data = HealthDataFactory .create_batch (
16511655 5 ,
0 commit comments