From 224e6cb8375600d30ca49a111000cf31e5034c31 Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Fri, 6 Dec 2024 12:35:54 -0500 Subject: [PATCH] replace explicit download_configs with references to download_configs in common --- api/scpca_portal/test/models/test_project.py | 49 ++++++-------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/api/scpca_portal/test/models/test_project.py b/api/scpca_portal/test/models/test_project.py index b5fd9282..432e1bb5 100644 --- a/api/scpca_portal/test/models/test_project.py +++ b/api/scpca_portal/test/models/test_project.py @@ -1,5 +1,6 @@ from django.test import TestCase +from scpca_portal import common from scpca_portal.models import Library from scpca_portal.test.factories import LibraryFactory, ProjectFactory @@ -18,13 +19,9 @@ def setUp(self): ) def test_get_libraries_valid_config(self): - download_config = { - "modality": "SINGLE_CELL", - "format": "SINGLE_CELL_EXPERIMENT", - "excludes_multiplexed": False, - "includes_merged": False, - "metadata_only": False, - } + download_config_name = "SINGLE_CELL_SINGLE_CELL_EXPERIMENT_MULTIPLEXED" + download_config = common.PROJECT_DOWNLOAD_CONFIGS[download_config_name] + result = self.project.get_libraries(download_config) self.assertIn(self.library_single_cell_no_multiplexed, result) self.assertIn(self.library_single_cell_multiplexed, result) @@ -54,51 +51,33 @@ def test_get_libraries_no_config_passed(self): self.assertIn(self.library_spatial, result) def test_get_libraries_metadata_only(self): - download_config = { - "modality": None, - "format": None, - "excludes_multiplexed": False, - "includes_merged": False, - "metadata_only": True, - } + download_config_name = "ALL_METADATA" + download_config = common.PROJECT_DOWNLOAD_CONFIGS[download_config_name] + result = self.project.get_libraries(download_config) self.assertIn(self.library_single_cell_no_multiplexed, result) self.assertIn(self.library_single_cell_multiplexed, result) self.assertIn(self.library_spatial, result) def test_get_libraries_excludes_multiplexed(self): - download_config = { - "modality": "SINGLE_CELL", - "format": "SINGLE_CELL_EXPERIMENT", - "excludes_multiplexed": True, - "includes_merged": False, - "metadata_only": False, - } + download_config_name = "SINGLE_CELL_SINGLE_CELL_EXPERIMENT" + download_config = common.PROJECT_DOWNLOAD_CONFIGS[download_config_name] + result = self.project.get_libraries(download_config) self.assertIn(self.library_single_cell_no_multiplexed, result) self.assertNotIn(self.library_single_cell_multiplexed, result) def test_get_libraries_includes_merged_merged_file_exists(self): - download_config = { - "modality": "SINGLE_CELL", - "format": "SINGLE_CELL_EXPERIMENT", - "excludes_multiplexed": True, - "includes_merged": True, - "metadata_only": False, - } + download_config_name = "SINGLE_CELL_SINGLE_CELL_EXPERIMENT_MERGED" + download_config = common.PROJECT_DOWNLOAD_CONFIGS[download_config_name] self.project.includes_merged_sce = True result = self.project.get_libraries(download_config) self.assertIn(self.library_single_cell_no_multiplexed, result) def test_get_libraries_includes_merged_no_merged_file(self): - download_config = { - "modality": "SINGLE_CELL", - "format": "SINGLE_CELL_EXPERIMENT", - "excludes_multiplexed": True, - "includes_merged": True, - "metadata_only": False, - } + download_config_name = "SINGLE_CELL_SINGLE_CELL_EXPERIMENT_MERGED" + download_config = common.PROJECT_DOWNLOAD_CONFIGS[download_config_name] self.project.includes_merged_sce = False self.project.includes_merged_anndata = False