def test_parse_checkpoint(uri, network_id, min_expected_score):
    try:
        checkpoint = parse_checkpoint_uri(uri, network_id)
    except EtherscanAPIError as e:
        warnings.warn(UserWarning(f'Etherscan API issue: "{e}"'))
    else:
        assert checkpoint.score >= min_expected_score
        assert is_block_hash(encode_hex(checkpoint.block_hash))
예제 #2
0
def test_parse_checkpoint(uri):
    checkpoint = parse_checkpoint_uri(uri)
    assert checkpoint.score >= MIN_EXPECTED_SCORE
    assert is_block_hash(encode_hex(checkpoint.block_hash))
예제 #3
0
def test_parse_checkpoint(uri, network_id, min_expected_score):
    checkpoint = parse_checkpoint_uri(uri, network_id)
    assert checkpoint.score >= min_expected_score
    assert is_block_hash(encode_hex(checkpoint.block_hash))
예제 #4
0
def test_throws_validation_error(uri):
    with pytest.raises(ValidationError):
        parse_checkpoint_uri(uri)
예제 #5
0
def test_parse_checkpoint(uri, expected):
    block_hash, block_number, block_score = expected
    checkpoint = parse_checkpoint_uri(uri)
    assert encode_hex(checkpoint.block_hash) == block_hash
    assert checkpoint.score == block_score