mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-09-30 20:28:12 +08:00
Applied "Introduction of ItemSource interface" patch
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import unittest
|
||||
from cellxgene_gateway.cache_entry import CacheEntry, CacheEntryStatus
|
||||
from cellxgene_gateway.cache_key import CacheKey
|
||||
from cellxgene_gateway.items.item import ItemType
|
||||
from cellxgene_gateway.items.file.fileitem import FileItem
|
||||
from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
||||
|
||||
key = CacheKey("czi/pbmc3k.h5ad", "pbmc3k.h5ad", "tmp.csv")
|
||||
key = CacheKey(
|
||||
FileItem("/czi/", "pbmc3k.h5ad", ItemType.h5ad),
|
||||
FileItemSource("/tmp", "local"),
|
||||
)
|
||||
|
||||
|
||||
class TestRenderEntry(unittest.TestCase):
|
||||
@@ -14,16 +20,14 @@ class TestRenderEntry(unittest.TestCase):
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
"src:url(/static/assets/"
|
||||
)
|
||||
expected = (
|
||||
"src:url(http://localhost:5005/view/czi/pbmc3k.h5ad/static/assets/"
|
||||
)
|
||||
expected = "src:url(http://localhost:5005/source/local/view/czi/pbmc3k.h5ad/static/assets/"
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_GIVEN_absolute_src_THEN_include_path(self):
|
||||
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
|
||||
'<link rel="shortcut icon" href="/static/assets/favicon.ico">'
|
||||
)
|
||||
expected = '<link rel="shortcut icon" href="http://localhost:5005/view/czi/pbmc3k.h5ad/static/assets/favicon.ico">'
|
||||
expected = '<link rel="shortcut icon" href="http://localhost:5005/source/local/view/czi/pbmc3k.h5ad/static/assets/favicon.ico">'
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user