Example #1
0
def test_account_creation_completed(dbsession, eth_network_id,
                                    eth_service: MockEthereumService,
                                    captured_registry_events):
    """We receive completed event on account creation."""

    with transaction.manager:
        network = dbsession.query(AssetNetwork).get(eth_network_id)

        address = CryptoAddress(network=network)

        dbsession.flush()

        # Generate address on the account
        op = CryptoAddressCreation(address)
        op.required_confirmation_count = 1
        dbsession.add(op)
        dbsession.flush()

        op_id = op.id

    eth_service.run_test_ops()

    # We get performed event on
    events = captured_registry_events
    assert len(events) == 2
    assert isinstance(events[0], CryptoOperationPerformed)
    assert isinstance(events[1], CryptoOperationCompleted)
def test_account_creation_completed(dbsession, eth_network_id, eth_service: MockEthereumService, captured_registry_events):
    """We receive completed event on account creation."""

    with transaction.manager:
        network = dbsession.query(AssetNetwork).get(eth_network_id)

        address = CryptoAddress(network=network)

        dbsession.flush()

        # Generate address on the account
        op = CryptoAddressCreation(address)
        op.required_confirmation_count = 1
        dbsession.add(op)
        dbsession.flush()

        op_id = op.id

    eth_service.run_test_ops()

    # We get performed event on
    events = captured_registry_events
    assert len(events) == 2
    assert isinstance(events[0], CryptoOperationPerformed)
    assert isinstance(events[1], CryptoOperationCompleted)
def test_deposit_completed(dbsession, eth_network_id, eth_service: MockEthereumService, eth_asset_id, topped_up_user, captured_registry_events):
    """We receive completed event on deposit."""

    with transaction.manager:
        user_address = dbsession.query(UserCryptoAddress).first()
        do_faux_deposit(user_address.address, eth_asset_id, 10)

    eth_service.run_test_ops()

    # We get performed event on
    events = captured_registry_events
    assert len(events) == 3
    assert isinstance(events[0], CryptoOperationPerformed)
    assert isinstance(events[1], IncomingCryptoDeposit)
    assert isinstance(events[2], CryptoOperationCompleted)
Example #4
0
def test_deposit_completed(dbsession, eth_network_id,
                           eth_service: MockEthereumService, eth_asset_id,
                           topped_up_user, captured_registry_events):
    """We receive completed event on deposit."""

    with transaction.manager:
        user_address = dbsession.query(UserCryptoAddress).first()
        do_faux_deposit(user_address.address, eth_asset_id, 10)

    eth_service.run_test_ops()

    # We get performed event on
    events = captured_registry_events
    assert len(events) == 3
    assert isinstance(events[0], CryptoOperationPerformed)
    assert isinstance(events[1], IncomingCryptoDeposit)
    assert isinstance(events[2], CryptoOperationCompleted)
Example #5
0
def eth_service(eth_network_id, dbsession, registry):
    # We don't run any real network facing operations, all operations are closed by tests
    s = MockEthereumService(eth_network_id, dbsession, registry)
    return s