test_categories.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:toshi-id-service 作者: toshiapp 项目源码 文件源码
def test_set_unknown_categories_fails(self):

        username = "toshibot"
        name = "ToshiBot"

        categories = await self.setup_categories()

        async with self.pool.acquire() as con:
            await con.execute("INSERT INTO users (username, toshi_id, name, is_app, is_public) VALUES ($1, $2, $3, true, true)",
                              username, TEST_ADDRESS, name)

        resp = await self.fetch_signed("/user", signing_key=TEST_PRIVATE_KEY, method="PUT", body={
            "categories": [categories[-1][0] + 10, 'badcat']
        })
        self.assertResponseCodeEqual(resp, 400)

        resp = await self.fetch("/user/{}".format(TEST_ADDRESS))
        self.assertResponseCodeEqual(resp, 200)
        body = json_decode(resp.body)
        self.assertIn("categories", body)
        self.assertEqual(len(body['categories']), 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号