Skip to content

Commit

Permalink
#87 patch enable annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Alok Saldanha authored and Alok Saldanha committed Mar 2, 2024
1 parent c4b9084 commit c1111e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_filecrawl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from collections import defaultdict
from unittest.mock import MagicMock, patch
from unittest.mock import patch

from cellxgene_gateway.filecrawl import (
render_item,
Expand Down Expand Up @@ -47,6 +47,7 @@ def test_GIVEN_path_no_slash_THEN_view_has_single_slash(self):


class TestRenderAnnotation(unittest.TestCase):
@patch('cellxgene_gateway.filecrawl.enable_annotations', new=True)
def test_GIVEN_no_annotation_THEN_new_alone(self):
entry = make_entry(annotations=None)
rendered = render_item(entry, source)
Expand All @@ -55,6 +56,7 @@ def test_GIVEN_no_annotation_THEN_new_alone(self):
rendered,
)

@patch('cellxgene_gateway.filecrawl.enable_annotations', new=True)
def test_GIVEN_annotation_THEN_new_before(self):
annotation = FileItem(
subpath="somepath/entry_annotations",
Expand All @@ -69,7 +71,8 @@ def test_GIVEN_annotation_THEN_new_before(self):
" <a href='/source/Files:/tmp/view/somepath/entry_annotations/annot.csv/'>annot</a></li>",
rendered,
)


@patch('cellxgene_gateway.filecrawl.enable_annotations', new=True)
def test_GIVEN_annotation_THEN_escaped(self):
annotation = FileItem(
subpath="somepath/entry_annotations",
Expand Down Expand Up @@ -119,8 +122,7 @@ def test_GIVEN_deep_nested_dirs_THEN_includes_dirs_in_output(self, item_source):
rendered,
"<li><a href='/filecrawl/foo/bar/baz?source=FakeSource'>baz</a><ul>"
"<li> <a href='/source/FakeSource/view/foo/bar/baz/file.h5ad/'>file.h5ad</a>"
" | annotations: <a class='new' href='/source/FakeSource/view/FakeAnnotations'>new</a>"
"</li></ul></li>",
" </li></ul></li>",
)

@patch(
Expand Down

0 comments on commit c1111e2

Please sign in to comment.