mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-02 01:58:12 +08:00
updated tests, formatting
This commit is contained in:
@@ -5,7 +5,9 @@ from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
||||
|
||||
|
||||
class TestFileItemSource(unittest.TestCase):
|
||||
def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(self):
|
||||
def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(
|
||||
self,
|
||||
):
|
||||
source = FileItemSource(tempfile.gettempdir(), "local")
|
||||
item = source.make_fileitem_from_path(
|
||||
"customanno.csv", "someh5ad_annotations", True
|
||||
|
||||
@@ -2,6 +2,7 @@ import unittest
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from cellxgene_gateway import flask_util
|
||||
from cellxgene_gateway.cache_entry import CacheEntry, CacheEntryStatus
|
||||
from cellxgene_gateway.cache_key import CacheKey
|
||||
from cellxgene_gateway.gateway import app
|
||||
@@ -27,13 +28,31 @@ class TestRenderEntry(unittest.TestCase):
|
||||
self.assertEqual(entry.status, CacheEntryStatus.loading)
|
||||
|
||||
def test_GIVEN_absolute_static_url_THEN_include_path(self):
|
||||
flask_util.include_source_in_url = False
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
"src:url(/static/assets/"
|
||||
)
|
||||
expected = "src:url(/view/czi/pbmc3k.h5ad/static/assets/"
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_GIVEN_absolute_src_THEN_include_path(self):
|
||||
flask_util.include_source_in_url = False
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
'<link rel="shortcut icon" href="/static/assets/favicon.ico">'
|
||||
)
|
||||
expected = '<link rel="shortcut icon" href="/view/czi/pbmc3k.h5ad/static/assets/favicon.ico">'
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_GIVEN_absolute_static_url_include_source_THEN_include_path(self):
|
||||
flask_util.include_source_in_url = True
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
"src:url(/static/assets/"
|
||||
)
|
||||
expected = "src:url(/source/local/view/czi/pbmc3k.h5ad/static/assets/"
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_GIVEN_absolute_src_THEN_include_path(self):
|
||||
def test_GIVEN_absolute_src_include_source_THEN_include_path(self):
|
||||
flask_util.include_source_in_url = True
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
'<link rel="shortcut icon" href="/static/assets/favicon.ico">'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user