smoketest.py 文件源码

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

项目:raiden 作者: raiden-network 项目源码 文件源码
def run_smoketests(raiden_service, test_config, debug=False):
    """ Test that the assembled raiden_service correctly reflects the configuration from the
    smoketest_genesis. """
    try:
        chain = raiden_service.chain
        assert (
            raiden_service.default_registry.address ==
            test_config['contracts']['registry_address'].decode('hex')
        )
        assert (
            raiden_service.default_registry.token_addresses() ==
            [test_config['contracts']['token_address'].decode('hex')]
        )
        assert len(chain.address_to_discovery.keys()) == 1
        assert (
            chain.address_to_discovery.keys()[0] ==
            test_config['contracts']['discovery_address'].decode('hex')
        )
        discovery = chain.address_to_discovery.values()[0]
        assert discovery.endpoint_by_address(raiden_service.address) != TEST_ENDPOINT

        assert len(raiden_service.token_to_channelgraph.values()) == 1
        graph = raiden_service.token_to_channelgraph.values()[0]
        channel = graph.partneraddress_to_channel[TEST_PARTNER_ADDRESS.decode('hex')]
        assert channel.can_transfer
        assert channel.contract_balance == channel.distributable == TEST_DEPOSIT_AMOUNT
        assert channel.state == CHANNEL_STATE_OPENED
        run_restapi_smoketests(raiden_service, test_config)
    except Exception:
        error = traceback.format_exc()
        if debug:
            pdb.post_mortem()
        return error
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号