Skip to content

Commit

Permalink
add test checking for throwing of no libraries errors in ComputedFile…
Browse files Browse the repository at this point in the history
…::get_{project, sample}_file
  • Loading branch information
avrohomgottlieb committed Dec 6, 2024
1 parent 5680e77 commit dc90349
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions api/scpca_portal/test/models/test_computed_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.test import TestCase

from scpca_portal.models import ComputedFile
from scpca_portal.test.factories import LibraryFactory, ProjectFactory, SampleFactory


class TestComputedFile(TestCase):
Expand All @@ -30,3 +31,32 @@ def test_computed_file_create_download_url(self, s3_endpoint, _):
},
ExpiresIn=604800,
)


class TestGetFile(TestCase):
def setUp(self) -> None:
self.project = ProjectFactory()
LibraryFactory(project=self.project)

self.sample = SampleFactory()
sample_library = LibraryFactory()
self.sample.libraries.add(sample_library)

def test_get_project_file_throw_no_libraries_error(self):
invalid_download_config = {
"modality": None,
"format": None,
"excludes_multiplexed": False,
"includes_merged": False,
"metadata_only": False,
}
with self.assertRaises(ValueError):
ComputedFile.get_project_file(self.project, invalid_download_config)

def test_get_sample_file_throw_no_libraries_error(self):
invalid_download_config = {
"modality": None,
"format": None,
}
with self.assertRaises(ValueError):
ComputedFile.get_sample_file(self.sample, invalid_download_config)

0 comments on commit dc90349

Please sign in to comment.