diff --git a/setup.cfg b/setup.cfg index 1a5a319..a6b0dd4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = rethink-note -version = 0.1.7 +version = 0.1.8 author = MorvanZhou author_email = morvanzhou@hotmail.com description = note taking app diff --git a/src/rethink/controllers/search/node_search.py b/src/rethink/controllers/search/node_search.py index 7cc10ed..761de4e 100644 --- a/src/rethink/controllers/search/node_search.py +++ b/src/rethink/controllers/search/node_search.py @@ -25,7 +25,7 @@ def cursor_query( message=const.get_msg_by_code(code, td.language), requestId=req.requestId, result=schemas.search.CursorQueryResponse.Result( - nodes=[schemas.node.NodesInfoResponse.NodeInfo( + nodes=[schemas.node.NodesInfoResponse.Data.NodeInfo( id=n["id"], title=n["title"], snippet=n["snippet"], diff --git a/tests/test_api.py b/tests/test_api.py index 8930350..47e07a9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -224,6 +224,22 @@ def test_node(self): rj = resp.json() self.assertEqual(0, rj["code"]) + resp = self.client.post( + "/api/search/cursor", + json={ + "requestId": "xxx", + "nid": node["id"], + "textBeforeCursor": "@How", + }, + headers={"token": self.token}, + ) + rj = resp.json() + self.assertEqual(0, rj["code"]) + self.assertEqual("xxx", rj["requestId"]) + self.assertEqual("How", rj["result"]["query"]) + self.assertEqual(1, len(rj["result"]["nodes"])) + self.assertEqual("How do I record", rj["result"]["nodes"][0]["title"]) + self.client.put( "/api/trash", json={