Example #1
0
def test_block_speficiation_to_number():
    web3 = MockWeb3(1)
    assert block_specification_to_number("latest", web3) == BlockNumber(42)
    assert block_specification_to_number("pending", web3) == BlockNumber(42)

    with pytest.raises(AssertionError):
        block_specification_to_number("whatever", web3)

    assert block_specification_to_number(EMPTY_HASH, web3) == BlockNumber(42)
    assert block_specification_to_number(BlockNumber(56),
                                         web3) == BlockNumber(56)

    with pytest.raises(AssertionError):
        block_specification_to_number([1, 2], web3)
Example #2
0
def test_setup_does_not_raise_with_matching_ids(netid):
    """Test that network setup works for the known network ids"""
    check_ethereum_network_id(netid, MockWeb3(netid))
Example #3
0
def test_check_network_id_raises_with_mismatching_ids():
    check_ethereum_network_id(ChainID(68), MockWeb3(68))

    with pytest.raises(RaidenError):
        check_ethereum_network_id(ChainID(61), MockWeb3(68))
Example #4
0
def test_check_network_id_raises_with_mismatching_ids():
    check_ethereum_network_id(68, MockWeb3(68))

    with pytest.raises(SystemExit):
        check_ethereum_network_id(61, MockWeb3(68))