コード例 #1
0
def test_bob_rpc_character_control_retrieve(bob_rpc_controller, retrieve_control_request):
    method_name, params = retrieve_control_request
    request_data = {'method': method_name, 'params': params}
    response = bob_rpc_controller.send(request_data)
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=BobInterface)
コード例 #2
0
def test_enrico_rpc_character_control_encrypt_message(
        enrico_rpc_controller_test_client, encrypt_control_request):
    method_name, params = encrypt_control_request
    request_data = {'method': method_name, 'params': params}
    response = enrico_rpc_controller_test_client.send(request_data)
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=EnricoInterface)
コード例 #3
0
def test_alice_rpc_character_control_grant(alice_rpc_test_client,
                                           grant_control_request):
    method_name, params = grant_control_request
    request_data = {'method': method_name, 'params': params}
    response = alice_rpc_test_client.send(request_data)
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=AliceInterface)
コード例 #4
0
def test_alice_rpc_character_control_derive_policy_encrypting_key(
        alice_rpc_test_client):
    method_name = 'derive_policy_encrypting_key'
    request_data = {'method': method_name, 'params': {'label': 'test'}}
    response = alice_rpc_test_client.send(request_data)
    assert response.success is True
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=AliceInterface)
コード例 #5
0
def test_bob_rpc_character_control_join_policy(bob_rpc_controller,
                                               join_control_request,
                                               enacted_blockchain_policy):
    # Simulate passing in a teacher-uri
    enacted_blockchain_policy.bob.remember_node(
        list(enacted_blockchain_policy.accepted_ursulas)[0])

    method_name, params = join_control_request
    request_data = {'method': method_name, 'params': params}
    response = bob_rpc_controller.send(request_data)
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=BobInterface)
コード例 #6
0
def test_bob_rpc_character_control_join_policy(bob_rpc_controller,
                                               join_control_request,
                                               enacted_blockchain_policy,
                                               blockchain_bob,
                                               blockchain_ursulas):
    for ursula in blockchain_ursulas:
        if ursula.checksum_address in enacted_blockchain_policy.treasure_map.destinations:
            # Simulate passing in a teacher-uri
            blockchain_bob.remember_node(ursula)
            break
    else:
        # Shouldn't happen
        raise Exception(
            "No known Ursulas present in the treasure map destinations")

    method_name, params = join_control_request
    request_data = {'method': method_name, 'params': params}
    response = bob_rpc_controller.send(request_data)
    assert validate_json_rpc_response_data(response=response,
                                           method_name=method_name,
                                           interface=BobInterface)