当前位置: 首页>>代码示例>>Python>>正文


Python Transaction.get_asset_id方法代码示例

本文整理汇总了Python中bigchaindb.models.Transaction.get_asset_id方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.get_asset_id方法的具体用法?Python Transaction.get_asset_id怎么用?Python Transaction.get_asset_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bigchaindb.models.Transaction的用法示例。


在下文中一共展示了Transaction.get_asset_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_asset_id_mismatch

# 需要导入模块: from bigchaindb.models import Transaction [as 别名]
# 或者: from bigchaindb.models.Transaction import get_asset_id [as 别名]
def test_asset_id_mismatch(alice, user_pk):
    from bigchaindb.models import Transaction
    from bigchaindb.common.exceptions import AssetIdMismatch

    tx1 = Transaction.create([alice.public_key], [([user_pk], 1)],
                             metadata={'msg': random.random()})
    tx1.sign([alice.private_key])
    tx2 = Transaction.create([alice.public_key], [([user_pk], 1)],
                             metadata={'msg': random.random()})
    tx2.sign([alice.private_key])

    with pytest.raises(AssetIdMismatch):
        Transaction.get_asset_id([tx1, tx2])
开发者ID:roderik,项目名称:bigchaindb,代码行数:15,代码来源:test_digital_assets.py

示例2: test_get_asset_id_transfer_transaction

# 需要导入模块: from bigchaindb.models import Transaction [as 别名]
# 或者: from bigchaindb.models.Transaction import get_asset_id [as 别名]
def test_get_asset_id_transfer_transaction(b, signed_create_tx, user_pk):
    from bigchaindb.models import Transaction

    tx_transfer = Transaction.transfer(signed_create_tx.to_inputs(), [([user_pk], 1)],
                                       signed_create_tx.id)
    asset_id = Transaction.get_asset_id(tx_transfer)
    assert asset_id == tx_transfer.asset['id']
开发者ID:roderik,项目名称:bigchaindb,代码行数:9,代码来源:test_digital_assets.py

示例3: test_get_txids_filtered

# 需要导入模块: from bigchaindb.models import Transaction [as 别名]
# 或者: from bigchaindb.models.Transaction import get_asset_id [as 别名]
def test_get_txids_filtered(signed_create_tx, signed_transfer_tx):
    from bigchaindb.backend import connect, query
    from bigchaindb.models import Transaction
    conn = connect()

    # create and insert two blocks, one for the create and one for the
    # transfer transaction
    conn.db.transactions.insert_one(signed_create_tx.to_dict())
    conn.db.transactions.insert_one(signed_transfer_tx.to_dict())

    asset_id = Transaction.get_asset_id([signed_create_tx, signed_transfer_tx])

    # Test get by just asset id
    txids = set(query.get_txids_filtered(conn, asset_id))
    assert txids == {signed_create_tx.id, signed_transfer_tx.id}

    # Test get by asset and CREATE
    txids = set(query.get_txids_filtered(conn, asset_id, Transaction.CREATE))
    assert txids == {signed_create_tx.id}

    # Test get by asset and TRANSFER
    txids = set(query.get_txids_filtered(conn, asset_id, Transaction.TRANSFER))
    assert txids == {signed_transfer_tx.id}
开发者ID:vrde,项目名称:bigchaindb,代码行数:25,代码来源:test_queries.py

示例4: test_get_asset_id_create_transaction

# 需要导入模块: from bigchaindb.models import Transaction [as 别名]
# 或者: from bigchaindb.models.Transaction import get_asset_id [as 别名]
def test_get_asset_id_create_transaction(alice, user_pk):
    from bigchaindb.models import Transaction
    tx_create = Transaction.create([alice.public_key], [([user_pk], 1)])
    assert Transaction.get_asset_id(tx_create) == tx_create.id
开发者ID:roderik,项目名称:bigchaindb,代码行数:6,代码来源:test_digital_assets.py


注:本文中的bigchaindb.models.Transaction.get_asset_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。