aboutsummaryrefslogtreecommitdiff
path: root/tests/uploader/test_entry.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/uploader/test_entry.py')
-rw-r--r--tests/uploader/test_entry.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/uploader/test_entry.py b/tests/uploader/test_entry.py
new file mode 100644
index 0000000..0c614a5
--- /dev/null
+++ b/tests/uploader/test_entry.py
@@ -0,0 +1,43 @@
+"""Test the entry module in the web-ui"""
+import pytest
+
+@pytest.mark.parametrize(
+ "dataitem,lower",
+ (
+ # expression data UI elements
+ (b'<h2 class="heading">expression data</h2>', True),
+ (b'<a href="/upload"', False),
+ (b'upload expression data</a>', False),
+
+ # samples/cases data UI elements
+ (b'<h2 class="heading">samples/cases</h2>', True),
+ (b'<a href="/samples/upload/species"', False),
+ (b'upload samples/cases', True),
+
+ # R/qtl2 data UI elements
+ (b'<h2 class="heading">r/qtl2 bundles</h2>', True),
+ (b'<a href="/upload/rqtl2/select-species"', False),
+ (b'upload r/qtl2 bundle', True)
+ ))
+def test_landing_page_has_sections(client, dataitem, lower):
+ """
+ GIVEN: A flask application testing client
+ WHEN: the index page is requested
+ THEN: ensure the page has the expected UI elements
+ """
+ resp = client.get("/")
+ assert resp.status_code == 200
+ assert dataitem in (resp.data.lower() if lower else resp.data)
+
+
+def test_landing_page_fails_with_post(client):
+ """
+ GIVEN: A flask application testing client
+ WHEN: the index page is requested with the "POST" method
+ THEN: ensure the system fails
+ """
+ resp = client.post("/")
+ assert resp.status_code == 405
+ assert (
+ b'<h1>405: The method is not allowed for the requested URL.</h1>'
+ in resp.data)