mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
merged main into refactor-backend
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
commit
dbbdcc88ff
35
.github/workflows/documenation.yml
vendored
35
.github/workflows/documenation.yml
vendored
@ -1,35 +0,0 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# Planetmint and IPDB software contributors.
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
name: Documentation
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
documentation:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
- name: Install tox
|
||||
run: python -m pip install --upgrade tox tox-gh-actions
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install .'[dev]'
|
||||
|
||||
- name: Run tox
|
||||
run: tox -e docsroot
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -53,7 +53,6 @@ pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
|
||||
@ -30,6 +30,12 @@ For reference, the possible headings are:
|
||||
* **Removed** removed text_search routes
|
||||
* **Added** metadata / asset cid route for fetching transactions
|
||||
|
||||
## [1.4.1] - 2022-21-12
|
||||
* **fixed** inconsistent cryptocondition keyring tag handling. Using cryptoconditions > 1.1.0 from now on.
|
||||
|
||||
## [1.4.0] - 2022-12-12
|
||||
* **Added** added upgrade compatibility to older nodes to support v2.0 TX validity for nodes supporting v3.0 transactions (planetmint-transactions >= 0.4.1)
|
||||
|
||||
## [1.3.2] - 2022-28-11
|
||||
* **Changed** new zenroom 2.3.1 support
|
||||
* **Changed** integrated new planetmint-cryptoconditions package (via the transactions package)
|
||||
|
||||
@ -41,7 +41,6 @@ services:
|
||||
- ./setup.py:/usr/src/app/setup.py
|
||||
- ./setup.cfg:/usr/src/app/setup.cfg
|
||||
- ./pytest.ini:/usr/src/app/pytest.ini
|
||||
- ./tox.ini:/usr/src/app/tox.ini
|
||||
environment:
|
||||
PLANETMINT_DATABASE_BACKEND: tarantool_db
|
||||
PLANETMINT_DATABASE_HOST: tarantool
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
aafigure==0.6
|
||||
alabaster==0.7.12
|
||||
Babel==2.10.1
|
||||
certifi==2021.10.8
|
||||
certifi==2022.12.7
|
||||
charset-normalizer==2.0.12
|
||||
commonmark==0.9.1
|
||||
docutils==0.17.1
|
||||
|
||||
@ -54,13 +54,13 @@ import sphinx_rtd_theme
|
||||
|
||||
extensions = [
|
||||
"myst_parser",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.autosectionlabel",
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.coverage",
|
||||
"sphinx.ext.viewcode",
|
||||
"sphinx.ext.todo",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinxcontrib.httpdomain",
|
||||
"aafigure.sphinxext",
|
||||
#'sphinx_toolbox.collapse',
|
||||
|
||||
@ -4,7 +4,7 @@ Content-Type: application/json
|
||||
{
|
||||
"assets": "/assets/",
|
||||
"blocks": "/blocks/",
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.3.1/http-client-server-api.html",
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.4.1/http-client-server-api.html",
|
||||
"metadata": "/metadata/",
|
||||
"outputs": "/outputs/",
|
||||
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",
|
||||
|
||||
@ -7,15 +7,13 @@ Content-Type: application/json
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"data": {
|
||||
"msg": "Hello Planetmint!"
|
||||
}
|
||||
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
|
||||
}
|
||||
],
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
|
||||
"fulfills": null,
|
||||
"owners_before": [
|
||||
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||
@ -39,7 +37,7 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
GET /api/v1/blocks?transaction_id=61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
|
||||
GET /api/v1/blocks?transaction_id=0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
|
||||
Host: example.com
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
GET /api/v1/transactions?operation=TRANSFER&asset_id=61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
|
||||
GET /api/v1/transactions?operation=TRANSFER&asset_id=0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
|
||||
Host: example.com
|
||||
|
||||
|
||||
@ -4,16 +4,16 @@ Content-Type: application/json
|
||||
[{
|
||||
"assets": [
|
||||
{
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
|
||||
}
|
||||
],
|
||||
"id": "b6e1ab3d48bbbbb0e40b952e70ec5d439b2745e0ba0c44b4ee877657e9ac33f0",
|
||||
"id": "8d11fe2bd91c4747a41e0c3dbe1400c511175be42f008d6cff92cbfa9e04f799",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUA4BB4fxDXK3CQTbKpH5gTAN76NG-iopNuuDEfBbZ1Fl-ipNU46t8VCvK9ghm9Q53aFRW6DDiW5wcWXxY0sS4EJ",
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCh-rpO-xqDm2fngjzxnKc39G16FpFMo0y50sHT7_uo1Itzvh4jsxnSGco2HjG6ZF-lSiGsASZ4uIIHuPM57yUI",
|
||||
"fulfills": {
|
||||
"output_index": 0,
|
||||
"transaction_id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
|
||||
"transaction_id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
|
||||
},
|
||||
"owners_before": [
|
||||
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||
@ -37,21 +37,21 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
},
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
|
||||
}
|
||||
],
|
||||
"id": "e43d3f93d90d22ef11c21607e3415bfcda4e0c7dd60412fbb55daf32978a3126",
|
||||
"id": "45c929b66d1b10db6c3c3e6b1adddc0778b473fced4a1f403c2646b25f3fd983",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUBjj_XTjB3yJdG8JMNKnkkHvcX_BTOkl-YacRD4yKqxUCeL-VTgbrLgi5a3gGxNJcTkZP1gF0nsby8cgV4xmOcB",
|
||||
"fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUAc6OAQcXppDxCazw0UK2nwghctKNiZYDDsSOkAn0eQE8QjZ7GLzJpVb92oGXw_4FF7cLE0gg3nNxu7taQ8xakE",
|
||||
"fulfills": {
|
||||
"output_index": 0,
|
||||
"transaction_id": "b6e1ab3d48bbbbb0e40b952e70ec5d439b2745e0ba0c44b4ee877657e9ac33f0"
|
||||
"transaction_id": "8d11fe2bd91c4747a41e0c3dbe1400c511175be42f008d6cff92cbfa9e04f799"
|
||||
},
|
||||
"owners_before": [
|
||||
"3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9"
|
||||
@ -75,5 +75,5 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
}]
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
GET /api/v1/transactions/61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
|
||||
GET /api/v1/transactions/0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
|
||||
Host: example.com
|
||||
|
||||
|
||||
@ -4,15 +4,13 @@ Content-Type: application/json
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"data": {
|
||||
"msg": "Hello Planetmint!"
|
||||
}
|
||||
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
|
||||
}
|
||||
],
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
|
||||
"fulfills": null,
|
||||
"owners_before": [
|
||||
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||
@ -36,5 +34,5 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ Content-Type: application/json
|
||||
"v1": {
|
||||
"assets": "/api/v1/assets/",
|
||||
"blocks": "/api/v1/blocks/",
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.2.2/http-client-server-api.html",
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.4.1/http-client-server-api.html",
|
||||
"metadata": "/api/v1/metadata/",
|
||||
"outputs": "/api/v1/outputs/",
|
||||
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",
|
||||
@ -15,7 +15,7 @@ Content-Type: application/json
|
||||
"validators": "/api/v1/validators"
|
||||
}
|
||||
},
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.2.2/",
|
||||
"docs": "https://docs.planetmint.io/projects/server/en/v1.4.1/",
|
||||
"software": "Planetmint",
|
||||
"version": "1.3.1"
|
||||
"version": "1.4.1"
|
||||
}
|
||||
|
||||
@ -5,15 +5,13 @@ Content-Type: application/json
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"data": {
|
||||
"msg": "Hello Planetmint!"
|
||||
}
|
||||
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
|
||||
}
|
||||
],
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
|
||||
"fulfills": null,
|
||||
"owners_before": [
|
||||
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||
@ -37,5 +35,5 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
}
|
||||
|
||||
@ -4,15 +4,13 @@ Content-Type: application/json
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"data": {
|
||||
"msg": "Hello Planetmint!"
|
||||
}
|
||||
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
|
||||
}
|
||||
],
|
||||
"id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
|
||||
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
|
||||
"inputs": [
|
||||
{
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
|
||||
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
|
||||
"fulfills": null,
|
||||
"owners_before": [
|
||||
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||
@ -36,5 +34,5 @@ Content-Type: application/json
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": "2.0"
|
||||
"version": "3.0"
|
||||
}
|
||||
|
||||
@ -3,14 +3,12 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import tarantool
|
||||
import logging
|
||||
|
||||
from itertools import repeat
|
||||
from importlib import import_module
|
||||
from transactions.common.exceptions import ConfigurationError
|
||||
from planetmint.config import Config
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
|
||||
BACKENDS = {
|
||||
"tarantool_db": "planetmint.backend.tarantool.connection.TarantoolDBConnection",
|
||||
@ -69,6 +67,7 @@ class DBConnection(metaclass=DBSingleton):
|
||||
**kwargs
|
||||
):
|
||||
"""Create a new :class:`~.Connection` instance.
|
||||
|
||||
Args:
|
||||
host (str): the host to connect to.
|
||||
port (int): the port to connect to.
|
||||
|
||||
@ -31,7 +31,7 @@ def store_asset(connection, asset: dict) -> Asset:
|
||||
@singledispatch
|
||||
def store_assets(connection, assets: list) -> list[Asset]:
|
||||
"""Write a list of assets to the assets table.
|
||||
backend
|
||||
|
||||
Args:
|
||||
assets (list): a list of assets to write.
|
||||
|
||||
@ -222,6 +222,7 @@ def store_transaction_outputs(connection, output: Output, index: int):
|
||||
@singledispatch
|
||||
def get_assets(connection, asset_ids) -> list[Asset]:
|
||||
"""Get a list of assets from the assets table.
|
||||
|
||||
Args:
|
||||
asset_ids (list): a list of ids for the assets to be retrieved from
|
||||
the database.
|
||||
|
||||
@ -9,7 +9,8 @@ import tarantool
|
||||
from planetmint.config import Config
|
||||
from transactions.common.exceptions import ConfigurationError
|
||||
from planetmint.utils import Lazy
|
||||
from planetmint.backend.connection import DBConnection, ConnectionError
|
||||
from planetmint.backend.connection import DBConnection
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -423,7 +423,7 @@ class Planetmint(object):
|
||||
|
||||
# validate asset id
|
||||
asset_id = tx.get_asset_id(input_txs)
|
||||
if asset_id != tx.assets[0]["id"]:
|
||||
if asset_id != Transaction.read_out_asset_id(tx):
|
||||
raise AssetIdMismatch(("The asset id of the input does not" " match the asset id of the" " transaction"))
|
||||
|
||||
# convert planetmint.Output objects to transactions.common.Output objects
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
__version__ = "1.3.2"
|
||||
__short_version__ = "1.3"
|
||||
__version__ = "1.4.1"
|
||||
__short_version__ = "1.4"
|
||||
|
||||
# Supported Tendermint versions
|
||||
__tm_supported_versions__ = ["0.34.15"]
|
||||
|
||||
@ -92,6 +92,13 @@ class TransactionListApi(Resource):
|
||||
except ValidationError as e:
|
||||
return make_error(400, "Invalid transaction ({}): {}".format(type(e).__name__, e))
|
||||
else:
|
||||
if tx_obj.version != Transaction.VERSION:
|
||||
return make_error(
|
||||
401,
|
||||
"Invalid transaction version: The transaction is valid, \
|
||||
but this node only accepts transaction with higher \
|
||||
schema version number.",
|
||||
)
|
||||
status_code, message = planet.write_transaction(tx_obj, mode)
|
||||
|
||||
if status_code == 202:
|
||||
|
||||
3
setup.py
3
setup.py
@ -103,7 +103,6 @@ tests_require = [
|
||||
"pytest-flask",
|
||||
"pytest-aiohttp",
|
||||
"pytest-asyncio",
|
||||
"tox",
|
||||
] + docs_require
|
||||
|
||||
install_requires = [
|
||||
@ -130,7 +129,7 @@ install_requires = [
|
||||
"planetmint-ipld>=0.0.3",
|
||||
"pyasn1>=0.4.8",
|
||||
"python-decouple",
|
||||
# "planetmint-transactions>=0.2.2",
|
||||
"planetmint-transactions>=0.5.0",
|
||||
]
|
||||
|
||||
setup(
|
||||
|
||||
@ -73,3 +73,19 @@ def test_create_valid_divisible_asset(b, user_pk, user_sk):
|
||||
tx = Create.generate([user_pk], [([user_pk], 2)])
|
||||
tx_signed = tx.sign([user_sk])
|
||||
assert b.validate_transaction(tx_signed) == tx_signed
|
||||
|
||||
|
||||
def test_v_2_0_validation_create(b, signed_2_0_create_tx):
|
||||
validated = b.validate_transaction(signed_2_0_create_tx)
|
||||
assert validated.to_dict() == signed_2_0_create_tx
|
||||
|
||||
|
||||
def test_v_2_0_validation_create_invalid(b, signed_2_0_create_tx_assets):
|
||||
assert b.validate_transaction(signed_2_0_create_tx_assets)
|
||||
|
||||
|
||||
def test_v_2_0_validation_transfer(b, signed_2_0_create_tx, signed_2_0_transfer_tx):
|
||||
validated = b.validate_transaction(signed_2_0_create_tx)
|
||||
b.store_bulk_transactions([validated])
|
||||
assert validated.to_dict() == signed_2_0_create_tx
|
||||
assert b.validate_transaction(signed_2_0_transfer_tx).to_dict() == signed_2_0_transfer_tx
|
||||
|
||||
@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
|
||||
def test_get_connection_raises_a_configuration_error(monkeypatch):
|
||||
from planetmint.backend.connection import ConnectionError
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
from planetmint.backend.tarantool.connection import TarantoolDBConnection
|
||||
|
||||
with pytest.raises(ConnectionError):
|
||||
|
||||
@ -735,3 +735,110 @@ def generate_votes(election, voters, keys):
|
||||
v = gen_vote(election, voter, keys)
|
||||
votes.append(v)
|
||||
return votes
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def signed_2_0_create_tx():
|
||||
return {
|
||||
"inputs": [
|
||||
{
|
||||
"owners_before": ["7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx"],
|
||||
"fulfills": None,
|
||||
"fulfillment": "pGSAIGC5nQ37hCCMAWIUBAJn4wVBOkHlURaWzWLjE5rTzG91gUC0Akx2m_AoPy1H6yTz7Ou2I-OGjNjWgvR5EATn8XZ1u-g91XL3CkSXXiL2sUJqDibJQJjGZjag_7fRu5_VkDUD",
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"public_keys": ["7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx"],
|
||||
"condition": {
|
||||
"details": {
|
||||
"type": "ed25519-sha-256",
|
||||
"public_key": "7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx",
|
||||
},
|
||||
"uri": "ni:///sha-256;xtKK2YRiX7_EPF2harsf-PELcJwfHQM7jZ_YvilEOOI?fpt=ed25519-sha-256&cost=131072",
|
||||
},
|
||||
"amount": "3000",
|
||||
}
|
||||
],
|
||||
"operation": "CREATE",
|
||||
"metadata": "QmRBri4SARi56PgB2ALFVjHsLhQDUh4jYbeiHaU94vLoxd",
|
||||
"asset": {"data": "QmW5GVMW98D3mktSDfWHS8nX2UiCd8gP1uCiujnFX4yK8n"},
|
||||
"version": "2.0",
|
||||
"id": "334014a29d99a488789c711b7dc5fceb534d1a9290b14d0270dbe6b60e2f036e",
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def signed_2_0_create_tx_assets():
|
||||
return {
|
||||
"inputs": [
|
||||
{
|
||||
"owners_before": ["5V4AANHTSLdQH1mEA1pohW3jMduY9xMJ1voos7gRfMQF"],
|
||||
"fulfills": None,
|
||||
"fulfillment": "pGSAIEKelMEu8AzcA9kcDLrsEXhSpZG-lf2c9CuZpzZU_ONkgUBMztcnweWqwHVfVk9Y-IRgfdh864yXYTrTKzSMy6uvNjQeLtGzKxz4gjb01NUu6WLvZBAvr0Ws4glfxKiDLjkP",
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"public_keys": ["5V4AANHTSLdQH1mEA1pohW3jMduY9xMJ1voos7gRfMQF"],
|
||||
"condition": {
|
||||
"details": {
|
||||
"type": "ed25519-sha-256",
|
||||
"public_key": "5V4AANHTSLdQH1mEA1pohW3jMduY9xMJ1voos7gRfMQF",
|
||||
},
|
||||
"uri": "ni:///sha-256;M3l9yVs7ItjP-lxT7B2ta6rpRa-GHt6TBSYpy8l-IS8?fpt=ed25519-sha-256&cost=131072",
|
||||
},
|
||||
"amount": "3000",
|
||||
}
|
||||
],
|
||||
"operation": "CREATE",
|
||||
"metadata": "QmRBri4SARi56PgB2ALFVjHsLhQDUh4jYbeiHaU94vLoxd",
|
||||
"assets": {"data": "QmW5GVMW98D3mktSDfWHS8nX2UiCd8gP1uCiujnFX4yK8n"},
|
||||
"version": "2.0",
|
||||
"id": "3e2a2c5eef5e6a0c4e1e5f8d0dc1d3d9b4f035592a9788f8bfa7d59f86d123d3",
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def signed_2_0_transfer_tx():
|
||||
return {
|
||||
"inputs": [
|
||||
{
|
||||
"owners_before": ["7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx"],
|
||||
"fulfills": {
|
||||
"transaction_id": "334014a29d99a488789c711b7dc5fceb534d1a9290b14d0270dbe6b60e2f036e",
|
||||
"output_index": 0,
|
||||
},
|
||||
"fulfillment": "pGSAIGC5nQ37hCCMAWIUBAJn4wVBOkHlURaWzWLjE5rTzG91gUBHNp8jobEyMqcIcIFl-TaAEDHRMyigDutgCIIomyVgb1a0LIk5eEpMTVP4ACxZnrVH-SIKEDHNdH4FGyBMka4B",
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"public_keys": ["3m1tUV5hmWPBaNQEoyFtZxFgDFiHYAYvPMzczNHwWp5v"],
|
||||
"condition": {
|
||||
"details": {
|
||||
"type": "ed25519-sha-256",
|
||||
"public_key": "3m1tUV5hmWPBaNQEoyFtZxFgDFiHYAYvPMzczNHwWp5v",
|
||||
},
|
||||
"uri": "ni:///sha-256;4pXSmxViATpOG8Mcc0gYsa-4bjRnLk5MY06VXv_UeJA?fpt=ed25519-sha-256&cost=131072",
|
||||
},
|
||||
"amount": "50",
|
||||
},
|
||||
{
|
||||
"public_keys": ["7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx"],
|
||||
"condition": {
|
||||
"details": {
|
||||
"type": "ed25519-sha-256",
|
||||
"public_key": "7WaJCRqUJMZjVyQxqq8GNjkw11gacFmDAZGPLdNxfBgx",
|
||||
},
|
||||
"uri": "ni:///sha-256;xtKK2YRiX7_EPF2harsf-PELcJwfHQM7jZ_YvilEOOI?fpt=ed25519-sha-256&cost=131072",
|
||||
},
|
||||
"amount": "2950",
|
||||
},
|
||||
],
|
||||
"operation": "TRANSFER",
|
||||
"metadata": "QmTjWHzypFxE8uuXJXMJQJxgAEKjoWmQimGiutmPyJ6CAB",
|
||||
"asset": {"id": "334014a29d99a488789c711b7dc5fceb534d1a9290b14d0270dbe6b60e2f036e"},
|
||||
"version": "2.0",
|
||||
"id": "e577641b0e2eb619e282f802516ce043e9d4af51dd4b6c959e18246e85cae2a6",
|
||||
}
|
||||
|
||||
31
tox.ini
31
tox.ini
@ -1,31 +0,0 @@
|
||||
[tox]
|
||||
skipsdist = true
|
||||
envlist = py{39}, docsroot
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
3.9 = docsroot
|
||||
|
||||
[base]
|
||||
basepython = python3.9
|
||||
deps = pip>=9.0.1
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
setenv =
|
||||
PYTHONPATH={toxinidir}:{toxinidir}/planetmint
|
||||
deps = {[base]deps}
|
||||
install_command = pip install {opts} {packages}
|
||||
extras = test
|
||||
commands = pytest -v -n auto --cov=planetmint --basetemp={envtmpdir}
|
||||
|
||||
[testenv:docsroot]
|
||||
basepython = {[base]basepython}
|
||||
changedir = docs/root/source
|
||||
deps =
|
||||
{[base]deps}
|
||||
typing-extensions
|
||||
-r{toxinidir}/docs/root/requirements.txt
|
||||
extras = None
|
||||
commands = sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user