Exemplo n.º 1
0
def mock_peer(connection, ip, port):
    from pyethereum.peer import Peer
    peer = Peer(connection, ip, port)

    def side_effect():
        for i in range(3):
            peer.loop_body()

    peer.run = mock.MagicMock()
    peer.run.side_effect = side_effect
    peer.start = peer.run
    return peer
Exemplo n.º 2
0
def step_impl(context):
    from pyethereum.peer import Peer
    context.peer_manager.connected_peers = [
        Peer(utils.mock_connection(), '1.1.1.1', 1234),
        Peer(utils.mock_connection(), '2.1.1.1', 1234),
    ]
Exemplo n.º 3
0
def step_impl(context):
    from pyethereum.peer import Peer
    context.peer = Peer(utils.mock_connection(), '1.1.1.1', 1234)
    context.peer.send_Ping = mock.MagicMock()