Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- Click
- cython
- defusedxml
- flask
- glymur
- h5py
- imagecodecs
Expand Down
1 change: 1 addition & 0 deletions requirements.dev.conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
- defusedxml
- flake8
- flake8-bugbear
- flask
- glymur
- h5py
- imagecodecs
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
albumentations>0.5.0
Click>=7.0
defusedxml
flask
glymur
imagecodecs
jupyterlab
Expand Down
1 change: 1 addition & 0 deletions requirements.win64.conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- Click
- cython
- defusedxml
- flask
- glymur
- h5py
- imagecodecs
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Click>=7.0
coverage==5.1
flake8-bugbear
flake8==3.7.8
flask
glymur
imagecodecs
jupyterlab
Expand Down
46 changes: 46 additions & 0 deletions tests/test_tileserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""Tests for tileserver."""
import pytest

from tiatoolbox.visualization.tileserver import TileServer
from tiatoolbox.wsicore.wsireader import WSIReader


@pytest.fixture()
def app(remote_sample) -> TileServer:
"""Create a testing TileServer WSGI app."""
wsi = WSIReader.open(remote_sample("ndpi-1"))
app = TileServer(title="test", layers={"ndpi": wsi})
app.config.from_mapping({"TESTING": True})
return app


def test_get_tile(app) -> None:
"""Get a single tile and check the status code and content type."""
with app.test_client() as client:
response = client.get("/layer/ndpi/zoomify/TileGroup0/0-0-0.jpg")
assert response.status_code == 200
assert response.content_type == "image/jpeg"


def test_get_tile_404(app) -> None:
"""Request a tile with an index."""
with app.test_client() as client:
response = client.get("/layer/ndpi/zoomify/TileGroup0/10-0-0.jpg")
assert response.status_code == 404
assert response.get_data(as_text=True) == "Tile not found"


def test_get_tile_layer_key_error(app) -> None:
"""Request a tile with an invalid layer key."""
with app.test_client() as client:
response = client.get("/layer/foo/zoomify/TileGroup0/0-0-0.jpg")
assert response.status_code == 404
assert response.get_data(as_text=True) == "Layer not found"


def test_get_index(app) -> None:
"""Get the index page and check that it is HTML."""
with app.test_client() as client:
response = client.get("/")
assert response.status_code == 200
assert response.content_type == "text/html; charset=utf-8"

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tiatoolbox/data/visualization/static/css/ol-ext.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tiatoolbox/data/visualization/static/css/ol.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tiatoolbox/data/visualization/static/js/ol-ext.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tiatoolbox/data/visualization/static/js/ol.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tiatoolbox/data/visualization/static/js/polyfill.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Disable minification (remove `.min` from URL path) for more info */

(function(undefined) {}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
Binary file not shown.
Loading