Merge branch 'master' into bug/1702/invalid-asset-data-keys
This commit is contained in:
commit
961d7f5b29
|
@ -50,6 +50,11 @@ def drop_database(conn, dbname):
|
|||
def create_bigchain_secondary_index(conn, dbname):
|
||||
logger.info('Create `bigchain` secondary index.')
|
||||
|
||||
# secondary index on block id which should be unique
|
||||
conn.conn[dbname]['bigchain'].create_index('id',
|
||||
name='block_id',
|
||||
unique=True)
|
||||
|
||||
# to order blocks by timestamp
|
||||
conn.conn[dbname]['bigchain'].create_index([('block.timestamp',
|
||||
ASCENDING)],
|
||||
|
|
|
@ -299,12 +299,13 @@ def test_count_blocks(signed_create_tx):
|
|||
from bigchaindb.models import Block
|
||||
conn = connect()
|
||||
|
||||
assert query.count_blocks(conn) == 0
|
||||
|
||||
# create and insert some blocks
|
||||
block = Block(transactions=[signed_create_tx])
|
||||
conn.db.bigchain.insert_one(block.to_dict())
|
||||
conn.db.bigchain.insert_one(block.to_dict())
|
||||
|
||||
assert query.count_blocks(conn) == 2
|
||||
assert query.count_blocks(conn) == 1
|
||||
|
||||
|
||||
def test_count_backlog(signed_create_tx):
|
||||
|
|
|
@ -22,8 +22,8 @@ def test_init_creates_db_tables_and_indexes():
|
|||
'votes']
|
||||
|
||||
indexes = conn.conn[dbname]['bigchain'].index_information().keys()
|
||||
assert sorted(indexes) == ['_id_', 'asset_id', 'block_timestamp', 'inputs',
|
||||
'outputs', 'transaction_id']
|
||||
assert sorted(indexes) == ['_id_', 'asset_id', 'block_id', 'block_timestamp',
|
||||
'inputs', 'outputs', 'transaction_id']
|
||||
|
||||
indexes = conn.conn[dbname]['backlog'].index_information().keys()
|
||||
assert sorted(indexes) == ['_id_', 'assignee__transaction_timestamp',
|
||||
|
@ -86,8 +86,8 @@ def test_create_secondary_indexes():
|
|||
|
||||
# Bigchain table
|
||||
indexes = conn.conn[dbname]['bigchain'].index_information().keys()
|
||||
assert sorted(indexes) == ['_id_', 'asset_id', 'block_timestamp', 'inputs',
|
||||
'outputs', 'transaction_id']
|
||||
assert sorted(indexes) == ['_id_', 'asset_id', 'block_id', 'block_timestamp',
|
||||
'inputs', 'outputs', 'transaction_id']
|
||||
|
||||
# Backlog table
|
||||
indexes = conn.conn[dbname]['backlog'].index_information().keys()
|
||||
|
|
Loading…
Reference in New Issue