Skip to content

Commit cae9268

Browse files
committed
Regenerated the client
1 parent ae9e413 commit cae9268

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/test_manual.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def tearDown(self):
3131

3232
async def utils_api_test(self, client=None):
3333
utilsApi = manticoresearch.UtilsApi(client)
34-
utilsApi.sql('query=DROP TABLE IF EXISTS movies')
35-
res = utilsApi.sql("CREATE TABLE IF NOT EXISTS movies (title text, plot text, _year integer, rating float, code multi) min_infix_len='2'")
34+
await utilsApi.sql('query=DROP TABLE IF EXISTS movies')
35+
res = await utilsApi.sql("CREATE TABLE IF NOT EXISTS movies (title text, plot text, _year integer, rating float, code multi) min_infix_len='2'")
3636
self.assertEqual(res.to_dict(), [{'total': 0, 'error': '', 'warning': ''}])
3737
print("Utils API tests successful")
3838

@@ -44,7 +44,7 @@ async def index_api_test(self, client=None):
4444
{"insert": {"table" : "movies", "id" : 3, "doc" : {"title" : "Star Trek 3: Nemesis", "plot": "The Enterprise is diverted to the Romulan homeworld Romulus, supposedly because they want to negotiate a peace treaty. Captain Picard and his crew discover a serious threat to the Federation once Praetor Shinzon plans to attack Earth.", "_year": 2003, "rating": 6.6, "code": [11,2,3]}}}, \
4545
{"insert": {"table" : "movies", "id" : 4, "doc" : {"title" : "Star Trek 4: Nemesis", "plot": "The Enterprise is diverted to the Romulan homeworld Romulus, supposedly because they want to negotiate a peace treaty. Captain Picard and his crew discover a serious threat to the Federation once Praetor Shinzon plans to attack Earth.", "_year": 2003, "rating": 6.5, "code": [1,2,4]}}},
4646
]
47-
res = indexApi.bulk('\n'.join(map(json.dumps,docs)))
47+
res = await indexApi.bulk('\n'.join(map(json.dumps,docs)))
4848
res_json = res.to_dict()
4949
self.assertEqual(res_json['items'][0]['bulk']['created'], 4)
5050
print("Index API tests successful")
@@ -62,28 +62,28 @@ async def search_api_test(self, client=None):
6262
search_request.query = searchQuery
6363

6464
searchApi = manticoresearch.SearchApi(client)
65-
res = searchApi.search(search_request)
65+
res = await searchApi.search(search_request)
6666
self.assertEqual(res.hits.hits[0].id, 4)
6767

6868
search_request = {"table":"movies","query":{"bool": {"must": [ {"match": {"title":"4"}}] }}}
6969

70-
res = searchApi.search(search_request)
70+
res = await searchApi.search(search_request)
7171
self.assertEqual(res.hits.hits[0].id, 4)
7272

7373
autocomplete_request = {"table":"movies","query": "Romul","options": {"fuzziness": 0, "layouts": "us,uk"} }
7474

75-
res = searchApi.autocomplete(autocomplete_request)
75+
res = await searchApi.autocomplete(autocomplete_request)
7676
self.assertEqual(res[0]['total'], 2)
7777
self.assertEqual(res[0]['data'][0]['query'], 'romulan')
7878
self.assertEqual(res[0]['data'][1]['query'], 'romulus')
7979

8080
print("Search API tests successful")
8181

8282
async def test_manual(self):
83-
client = manticoresearch.ApiClient(self.configuration)
84-
await self.utils_api_test(client)
85-
await self.index_api_test(client)
86-
await self.search_api_test(client)
83+
async with manticoresearch.ApiClient(self.configuration) as client:
84+
await self.utils_api_test(client)
85+
await self.index_api_test(client)
86+
await self.search_api_test(client)
8787

8888
print("\nTests finished")
8989
if __name__ == '__main__':

0 commit comments

Comments
 (0)