def test_username_query(self):
username = "TokenBot"
positive_query = 'enb'
negative_query = 'TickleFight'
async with self.pool.acquire() as con:
await con.execute("INSERT INTO apps (name, token_id) VALUES ($1, $2)", username, TEST_ADDRESS)
await con.execute("INSERT INTO sofa_manifests (token_id, payment_address) VALUES ($1, $2)", TEST_ADDRESS, TEST_ADDRESS)
resp = await self.fetch("/search/apps?query={}".format(positive_query), method="GET")
self.assertEqual(resp.code, 200)
body = json_decode(resp.body)
self.assertEqual(len(body['apps']), 1)
resp = await self.fetch("/search/apps?query={}".format(negative_query), method="GET")
self.assertEqual(resp.code, 200)
body = json_decode(resp.body)
self.assertEqual(len(body['apps']), 0)
test_apps_search.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录