test_pn_registration.py 文件源码

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

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

        body = {
            "registration_id": TEST_APN_ID,
        }

        timestamp = int(time.time())
        signature = sign_request(FAUCET_PRIVATE_KEY, "POST", "/v1/apn/register", timestamp, json_encode(body).encode('utf-8'))

        resp = await self.fetch_signed("/apn/register", method="POST", body=body,
                                       signature=signature, address=TEST_ADDRESS, timestamp=timestamp)

        self.assertEqual(resp.code, 400, resp.body)

        async with self.pool.acquire() as con:

            rows1 = await con.fetch("SELECT * FROM notification_registrations WHERE toshi_id = $1", TEST_ADDRESS)
            rows2 = await con.fetch("SELECT * FROM notification_registrations WHERE toshi_id = $1", FAUCET_ADDRESS)

        self.assertEqual(len(rows1), 0)
        self.assertEqual(len(rows2), 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号