diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-29 11:30:47 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-29 11:30:47 +1100 |
| commit | 8781fdb2b8c530a6c1531ae9e82221eb062e34fb (patch) | |
| tree | ffd824aa9b945d69b47f012617ee13d98764d078 /backend/tests/test_tilo.py | |
| parent | f5e87ae628bab0eef97b3e3e62f6d71cca9c99c0 (diff) | |
Adjust backend coding style
Add line spacing, section comments, and import consistency
Diffstat (limited to 'backend/tests/test_tilo.py')
| -rw-r--r-- | backend/tests/test_tilo.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/backend/tests/test_tilo.py b/backend/tests/test_tilo.py index cfc719a..718fb8b 100644 --- a/backend/tests/test_tilo.py +++ b/backend/tests/test_tilo.py @@ -1,5 +1,6 @@ import unittest -import tempfile, os +import tempfile +import os from tests.common import createTestDbTable from tilo import handleReq, TolNode, SearchSuggResponse, SearchSugg, InfoResponse, NodeInfo, DescInfo, ImgInfo @@ -122,8 +123,10 @@ class TestHandleReq(unittest.TestCase): self.tempDir = tempfile.TemporaryDirectory() self.dbFile = os.path.join(self.tempDir.name, 'data.db') initTestDb(self.dbFile) + def tearDown(self): self.tempDir.cleanup() + def test_node_req(self): response = handleReq(self.dbFile, {'QUERY_STRING': 'name=two&type=node&tree=trimmed'}) self.assertEqual(response, { @@ -131,6 +134,7 @@ class TestHandleReq(unittest.TestCase): 'three': TolNode('ott3', [], 'two', 1, False, None, None, None), 'four': TolNode('ott4', [], 'two', 1, True, None, 'ott4.jpg', None), }) + def test_node_toroot_req(self): response = handleReq(self.dbFile, {'QUERY_STRING': 'name=seven&type=node&toroot=1&excl=five&tree=trimmed'}) self.assertEqual(response, { @@ -138,6 +142,7 @@ class TestHandleReq(unittest.TestCase): 'six': TolNode('ott6', ['seven'], 'five', 1, 1, 'VI', 'ott6.jpg', 'endangered'), 'seven': TolNode('ott7', [], 'six', 1, 1, None, None, None), }) + def test_sugg_req(self): response = handleReq(self.dbFile, {'QUERY_STRING': 'name=t&type=sugg&tree=trimmed'}) self.assertEqual(response, SearchSuggResponse( @@ -148,6 +153,7 @@ class TestHandleReq(unittest.TestCase): ], False )) + def test_info_req(self): response = handleReq(self.dbFile, {'QUERY_STRING': 'name=six&type=info&tree=trimmed'}) self.assertEqual(response, InfoResponse( |
