]> git.jsancho.org Git - datasette-pytables.git/commitdiff
Some html basic tests
authorJavier Sancho <jsf@jsancho.org>
Tue, 29 May 2018 11:21:21 +0000 (13:21 +0200)
committerJavier Sancho <jsf@jsancho.org>
Tue, 29 May 2018 11:21:21 +0000 (13:21 +0200)
tests/test_html.py [new file with mode: 0644]

diff --git a/tests/test_html.py b/tests/test_html.py
new file mode 100644 (file)
index 0000000..a1ccaf3
--- /dev/null
@@ -0,0 +1,31 @@
+from .fixtures import app_client
+import pytest
+
+pytest.fixture(scope='module')(app_client)
+
+def test_homepage(app_client):
+    response = app_client.get('/', gather_request=False)
+    assert response.status == 200
+    assert 'test_tables' in response.text
+
+def test_database_page(app_client):
+    response = app_client.get('/test_tables', allow_redirects=False, gather_request=False)
+    assert response.status == 302
+    response = app_client.get('/test_tables', gather_request=False)
+    assert 'test_tables' in response.text
+
+def test_table(app_client):
+    response = app_client.get('/test_tables/%2Fgroup1%2Ftable1', gather_request=False)
+    assert response.status == 200
+
+def test_table_row(app_client):
+    response = app_client.get('/test_tables/%2Fgroup1%2Ftable1/50', gather_request=False)
+    assert response.status == 200
+
+def test_array(app_client):
+    response = app_client.get('/test_tables/%2Fgroup1%2Farray2', gather_request=False)
+    assert response.status == 200
+
+def test_array_row(app_client):
+    response = app_client.get('/test_tables/%2Fgroup1%2Farray2/1050', gather_request=False)
+    assert response.status == 200