#24 make static paths relative

This commit is contained in:
Alok Saldanha
2020-08-16 16:06:34 -04:00
parent 4105fc32e1
commit 486206bd32
3 changed files with 32 additions and 16 deletions
+16
View File
@@ -0,0 +1,16 @@
import unittest
from cellxgene_gateway.cache_entry import CacheEntry
from cellxgene_gateway.cache_key import CacheKey
key = CacheKey('path/part', 'dataset', 'tmp.csv')
class TestRenderEntry(unittest.TestCase):
def test_GIVEN_absolute_static_url_THEN_return_relative(self):
actual = CacheEntry.for_key(key, 8000).rewrite_text_content("src:url(/static/assets/")
expected = "src:url(static/assets/"
self.assertEqual(actual, expected)
def test_GIVEN_absolute_src_THEN_return_relative(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="static/assets/favicon.ico">'
self.assertEqual(actual, expected)