Unit tests

Introduction

Some unit tests used to verify functionality.

Backend tests

cryptoassets.core.tests.base.has_inet()[source]

py.test condition for checking if we are online.

cryptoassets.core.tests.base.has_local_bitcoind()[source]

Use this to disable some tests in CI enviroment where 15 minute deadline applies.

cryptoassets.core.tests.base.is_slow_test_hostile()[source]

Use this to disable some tests in CI enviroment where 15 minute deadline applies.

class cryptoassets.core.tests.base.CoinTestRoot[source]

Have only initialization methods for the tests.

create_engine()[source]

Create SQLAclhemy database engine for the tests.

wait_address(address)[source]

block.io needs subscription refresh every time we create a new address.

Because we do not have IPC mechanism to tell when block.io refresh is ready, we just wait few seconds for now. block.io poller should recheck the database for new addresses every second.

setup_receiving(wallet)[source]

Necerssary setup to monitor incoming transactions for the backend.

teardown_receiving()[source]

Teardown incoming transaction monitoring.

setup_coin()[source]

Setup coin backend for this test case.

setup_balance()[source]

Create an a wallet and an account with balance.

class cryptoassets.core.tests.base.CoinTestCase[source]

Abstract base class for all cryptocurrency backend tests.

This verifies that a cryptocurrency backend works against cryptoassets.core models API.

Inherit from this test case, implement backend abstract methods and run the test case. If all test passes, the backend is compatible with cryptoassets.core.

test_create_address()[source]

Creates a new wallet and fresh bitcoin address there.

test_get_receiving_addresses()[source]

Creates a new wallet and fresh bitcoin address there.

test_create_account()[source]

Creates a new wallet and fresh bitcoin address there.

test_send_internal()[source]

Creates a new wallet and fresh bitcoin address there.

test_send_internal_low_balance()[source]

Does internal transaction where balance requirement is not met.

test_send_internal_same_account()[source]

Does internal transaction where balance requirement is not met.

test_cannot_import_existing_address()[source]

Do not allow importing an address which already exists.

test_refresh_account_balance()[source]

Read the external balance to an account.

test_send_external()[source]

Send Bitcoins from external address

test_charge_network_fee()[source]

Do an external transaction and see we account network fees correctly.

test_broadcast_no_transactions()[source]

Broadcast must not fail even we don’t have any transactions.

test_receive_external_spoofed()[source]

Test receiving external transaction.

Don’t actually receive anything, spoof the incoming transaction.