コード例 #1
0
def test_confirm_bad_signature(test_http_client: Client) -> None:
    """Test that RPCException is raised when trying to confirm an invalid signature."""
    with pytest.raises(RPCException) as exc_info:
        test_http_client.confirm_transaction("foo")
    err_object = exc_info.value.args[0]
    assert err_object == {
        "code": -32602,
        "message": "Invalid param: WrongSize"
    }
コード例 #2
0
def test_request_air_drop(stubbed_sender: Keypair, stubbed_receiver: Keypair,
                          test_http_client: Client):
    """Test air drop to stubbed_sender and stubbed_receiver."""
    # Airdrop to stubbed_sender
    resp = test_http_client.request_airdrop(stubbed_sender.public_key,
                                            AIRDROP_AMOUNT)
    assert_valid_response(resp)
    test_http_client.confirm_transaction(resp["result"])
    balance = test_http_client.get_balance(stubbed_sender.public_key)
    assert balance["result"]["value"] == AIRDROP_AMOUNT
    # Airdrop to stubbed_receiver
    resp = test_http_client.request_airdrop(stubbed_receiver, AIRDROP_AMOUNT)
    assert_valid_response(resp)
    test_http_client.confirm_transaction(resp["result"])
    balance = test_http_client.get_balance(stubbed_receiver)
    assert balance["result"]["value"] == AIRDROP_AMOUNT