mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00
Changed base folder name. Application running fine on docker
This commit is contained in:
parent
ed1d4b82ad
commit
a95bbae9e6
@ -10,5 +10,5 @@ set -e -x
|
||||
if [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
sleep 3600
|
||||
else
|
||||
bigchaindb -l DEBUG start
|
||||
planetmint -l DEBUG start
|
||||
fi
|
||||
|
@ -10,7 +10,7 @@ set -e -x
|
||||
if [[ -z ${TOXENV} ]]; then
|
||||
|
||||
if [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose up -d bigchaindb
|
||||
docker-compose up -d planetmint
|
||||
else
|
||||
docker-compose up -d bdb
|
||||
fi
|
||||
|
@ -12,10 +12,10 @@ pip install --upgrade pip
|
||||
if [[ -n ${TOXENV} ]]; then
|
||||
pip install --upgrade tox
|
||||
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose build --no-cache --build-arg abci_status=enable bigchaindb
|
||||
docker-compose build --no-cache --build-arg abci_status=enable planetmint
|
||||
elif [[ $PLANETMINT_INTEGRATION_TEST == 'enable' ]]; then
|
||||
docker-compose build bigchaindb python-driver
|
||||
docker-compose build planetmint python-driver
|
||||
else
|
||||
docker-compose build --no-cache bigchaindb
|
||||
docker-compose build --no-cache planetmint
|
||||
pip install --upgrade codecov
|
||||
fi
|
||||
|
@ -10,9 +10,9 @@ set -e -x
|
||||
if [[ -n ${TOXENV} ]]; then
|
||||
tox -e ${TOXENV}
|
||||
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose exec bigchaindb pytest -v -m abci
|
||||
docker-compose exec planetmint pytest -v -m abci
|
||||
elif [[ ${PLANETMINT_ACCEPTANCE_TEST} == 'enable' ]]; then
|
||||
./run-acceptance-test.sh
|
||||
else
|
||||
docker-compose exec bigchaindb pytest -v --cov=bigchaindb --cov-report xml:htmlcov/coverage.xml
|
||||
docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
|
||||
fi
|
||||
|
@ -32,4 +32,4 @@ RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
WORKDIR /usr/src/app
|
||||
RUN pip install -e .[dev]
|
||||
RUN bigchaindb -y configure
|
||||
RUN planetmint -y configure
|
||||
|
14
Makefile
14
Makefile
@ -56,34 +56,34 @@ help: ## Show this help
|
||||
@$(HELP) < $(MAKEFILE_LIST)
|
||||
|
||||
run: check-deps ## Run Planetmint from source (stop it with ctrl+c)
|
||||
# although bigchaindb has tendermint and mongodb in depends_on,
|
||||
# although planetmint has tendermint and mongodb in depends_on,
|
||||
# launch them first otherwise tendermint will get stuck upon sending yet another log
|
||||
# due to some docker-compose issue; does not happen when containers are run as daemons
|
||||
@$(DC) up --no-deps mongodb tendermint bigchaindb
|
||||
@$(DC) up --no-deps mongodb tendermint planetmint
|
||||
|
||||
start: check-deps ## Run Planetmint from source and daemonize it (stop with `make stop`)
|
||||
@$(DC) up -d bigchaindb
|
||||
@$(DC) up -d planetmint
|
||||
|
||||
stop: check-deps ## Stop Planetmint
|
||||
@$(DC) stop
|
||||
|
||||
logs: check-deps ## Attach to the logs
|
||||
@$(DC) logs -f bigchaindb
|
||||
@$(DC) logs -f planetmint
|
||||
|
||||
test: check-deps test-unit test-acceptance ## Run unit and acceptance tests
|
||||
|
||||
test-unit: check-deps ## Run all tests once
|
||||
@$(DC) up -d bdb
|
||||
@$(DC) exec bigchaindb pytest
|
||||
@$(DC) exec planetmint pytest
|
||||
|
||||
test-unit-watch: check-deps ## Run all tests and wait. Every time you change code, tests will be run again
|
||||
@$(DC) run --rm --no-deps bigchaindb pytest -f
|
||||
@$(DC) run --rm --no-deps planetmint pytest -f
|
||||
|
||||
test-acceptance: check-deps ## Run all acceptance tests
|
||||
@./run-acceptance-test.sh
|
||||
|
||||
cov: check-deps ## Check code coverage and open the result in the browser
|
||||
@$(DC) run --rm bigchaindb pytest -v --cov=bigchaindb --cov-report html
|
||||
@$(DC) run --rm planetmint pytest -v --cov=planetmint --cov-report html
|
||||
$(BROWSER) htmlcov/index.html
|
||||
|
||||
doc: check-deps ## Generate HTML documentation and open it in the browser
|
||||
|
@ -6,7 +6,7 @@
|
||||
version: '2.2'
|
||||
|
||||
services:
|
||||
# Build: docker-compose build -d bigchaindb
|
||||
# Build: docker-compose build -d planetmint
|
||||
# Run: docker-compose run -d bdb
|
||||
mongodb:
|
||||
image: mongo:3.6
|
||||
@ -14,7 +14,7 @@ services:
|
||||
- "27017:27017"
|
||||
command: mongod
|
||||
restart: always
|
||||
bigchaindb:
|
||||
planetmint:
|
||||
depends_on:
|
||||
- mongodb
|
||||
- tendermint
|
||||
@ -22,7 +22,7 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile-dev
|
||||
volumes:
|
||||
- ./bigchaindb:/usr/src/app/bigchaindb
|
||||
- ./planetmint:/usr/src/app/planetmint
|
||||
- ./tests:/usr/src/app/tests
|
||||
- ./docs:/usr/src/app/docs
|
||||
- ./htmlcov:/usr/src/app/htmlcov
|
||||
@ -36,7 +36,7 @@ services:
|
||||
PLANETMINT_DATABASE_PORT: 27017
|
||||
PLANETMINT_SERVER_BIND: 0.0.0.0:9984
|
||||
PLANETMINT_WSSERVER_HOST: 0.0.0.0
|
||||
PLANETMINT_WSSERVER_ADVERTISED_HOST: bigchaindb
|
||||
PLANETMINT_WSSERVER_ADVERTISED_HOST: planetmint
|
||||
PLANETMINT_TENDERMINT_HOST: tendermint
|
||||
PLANETMINT_TENDERMINT_PORT: 26657
|
||||
ports:
|
||||
@ -44,7 +44,7 @@ services:
|
||||
- "9985:9985"
|
||||
- "26658"
|
||||
healthcheck:
|
||||
test: ["CMD", "bash", "-c", "curl http://bigchaindb:9984 && curl http://tendermint:26657/abci_query"]
|
||||
test: ["CMD", "bash", "-c", "curl http://planetmint:9984 && curl http://tendermint:26657/abci_query"]
|
||||
interval: 3s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
@ -58,19 +58,19 @@ services:
|
||||
ports:
|
||||
- "26656:26656"
|
||||
- "26657:26657"
|
||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --proxy_app=tcp://bigchaindb:26658"
|
||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --proxy_app=tcp://planetmint:26658"
|
||||
restart: always
|
||||
bdb:
|
||||
image: busybox
|
||||
depends_on:
|
||||
bigchaindb:
|
||||
planetmint:
|
||||
condition: service_healthy
|
||||
|
||||
|
||||
# curl client to check the health of development env
|
||||
curl-client:
|
||||
image: appropriate/curl
|
||||
command: /bin/sh -c "curl -s http://bigchaindb:9984/ > /dev/null && curl -s http://tendermint:26657/ > /dev/null"
|
||||
command: /bin/sh -c "curl -s http://planetmint:9984/ > /dev/null && curl -s http://tendermint:26657/ > /dev/null"
|
||||
|
||||
# Planetmint setup to do acceptance testing with Python
|
||||
python-acceptance:
|
||||
@ -81,7 +81,7 @@ services:
|
||||
- ./acceptance/python/docs:/docs
|
||||
- ./acceptance/python/src:/src
|
||||
environment:
|
||||
- PLANETMINT_ENDPOINT=bigchaindb
|
||||
- PLANETMINT_ENDPOINT=planetmint
|
||||
|
||||
# Build docs only
|
||||
# docker-compose build bdocs
|
||||
|
@ -9,9 +9,9 @@ import json
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from bigchaindb.common.transaction import Transaction, Input, TransactionLink
|
||||
from bigchaindb import lib
|
||||
from bigchaindb.web import server
|
||||
from planetmint.common.transaction import Transaction, Input, TransactionLink
|
||||
from planetmint import lib
|
||||
from planetmint.web import server
|
||||
|
||||
|
||||
TPLS = {}
|
||||
|
@ -6,11 +6,11 @@
|
||||
import copy
|
||||
import logging
|
||||
|
||||
from bigchaindb.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
from bigchaindb.lib import BigchainDB # noqa
|
||||
from bigchaindb.migrations.chain_migration_election import ChainMigrationElection
|
||||
from bigchaindb.version import __version__ # noqa
|
||||
from bigchaindb.core import App # noqa
|
||||
from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
from planetmint.lib import BigchainDB # noqa
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint.version import __version__ # noqa
|
||||
from planetmint.core import App # noqa
|
||||
|
||||
# from functools import reduce
|
||||
# PORT_NUMBER = reduce(lambda x, y: x * y, map(ord, 'BigchainDB')) % 2**16
|
||||
@ -94,10 +94,10 @@ config = {
|
||||
# the user wants to reconfigure the node. Check ``bigchaindb.config_utils``
|
||||
# for more info.
|
||||
_config = copy.deepcopy(config)
|
||||
from bigchaindb.common.transaction import Transaction # noqa
|
||||
from bigchaindb import models # noqa
|
||||
from bigchaindb.upsert_validator import ValidatorElection # noqa
|
||||
from bigchaindb.elections.vote import Vote # noqa
|
||||
from planetmint.common.transaction import Transaction # noqa
|
||||
from planetmint import models # noqa
|
||||
from planetmint.upsert_validator import ValidatorElection # noqa
|
||||
from planetmint.elections.vote import Vote # noqa
|
||||
|
||||
Transaction.register_type(Transaction.CREATE, models.Transaction)
|
||||
Transaction.register_type(Transaction.TRANSFER, models.Transaction)
|
@ -12,6 +12,6 @@ configuration or the ``PLANETMINT_DATABASE_BACKEND`` environment variable.
|
||||
"""
|
||||
|
||||
# Include the backend interfaces
|
||||
from bigchaindb.backend import schema, query # noqa
|
||||
from planetmint.backend import schema, query # noqa
|
||||
|
||||
from bigchaindb.backend.connection import connect # noqa
|
||||
from planetmint.backend.connection import connect # noqa
|
@ -7,13 +7,13 @@ import logging
|
||||
from importlib import import_module
|
||||
from itertools import repeat
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.backend.exceptions import ConnectionError
|
||||
from bigchaindb.backend.utils import get_bigchaindb_config_value, get_bigchaindb_config_value_or_key_error
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
import planetmint
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
from planetmint.backend.utils import get_bigchaindb_config_value, get_bigchaindb_config_value_or_key_error
|
||||
from planetmint.common.exceptions import ConfigurationError
|
||||
|
||||
BACKENDS = {
|
||||
'localmongodb': 'bigchaindb.backend.localmongodb.connection.LocalMongoDBConnection',
|
||||
'localmongodb': 'planetmint.backend.localmongodb.connection.LocalMongoDBConnection',
|
||||
}
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -37,7 +37,7 @@ def connect(backend=None, host=None, port=None, name=None, max_tries=None,
|
||||
MongoDB connections).
|
||||
|
||||
Returns:
|
||||
An instance of :class:`~bigchaindb.backend.connection.Connection`
|
||||
An instance of :class:`~planetmint.backend.connection.Connection`
|
||||
based on the given (or defaulted) :attr:`backend`.
|
||||
|
||||
Raises:
|
||||
@ -113,7 +113,7 @@ class Connection:
|
||||
configuration's ``database`` settings
|
||||
"""
|
||||
|
||||
dbconf = bigchaindb.config['database']
|
||||
dbconf = planetmint.config['database']
|
||||
|
||||
self.host = host or dbconf['host']
|
||||
self.port = port or dbconf['port']
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from bigchaindb.exceptions import BigchainDBError
|
||||
from planetmint.exceptions import BigchainDBError
|
||||
|
||||
|
||||
class BackendError(BigchainDBError):
|
@ -22,7 +22,7 @@ generic backend interfaces to the implementations in this module.
|
||||
"""
|
||||
|
||||
# Register the single dispatched modules on import.
|
||||
from bigchaindb.backend.localmongodb import schema, query # noqa
|
||||
from planetmint.backend.localmongodb import schema, query # noqa
|
||||
|
||||
# MongoDBConnection should always be accessed via
|
||||
# ``bigchaindb.backend.connect()``.
|
@ -8,13 +8,13 @@ from ssl import CERT_REQUIRED
|
||||
|
||||
import pymongo
|
||||
|
||||
from bigchaindb.backend.connection import Connection
|
||||
from bigchaindb.backend.exceptions import (DuplicateKeyError,
|
||||
from planetmint.backend.connection import Connection
|
||||
from planetmint.backend.exceptions import (DuplicateKeyError,
|
||||
OperationError,
|
||||
ConnectionError)
|
||||
from bigchaindb.backend.utils import get_bigchaindb_config_value
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from bigchaindb.utils import Lazy
|
||||
from planetmint.backend.utils import get_bigchaindb_config_value
|
||||
from planetmint.common.exceptions import ConfigurationError
|
||||
from planetmint.utils import Lazy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
from pymongo import DESCENDING
|
||||
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.backend.exceptions import DuplicateKeyError
|
||||
from bigchaindb.backend.utils import module_dispatch_registrar
|
||||
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint import backend
|
||||
from planetmint.backend.exceptions import DuplicateKeyError
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
register_query = module_dispatch_registrar(backend.query)
|
||||
|
@ -10,9 +10,9 @@ import logging
|
||||
from pymongo import ASCENDING, DESCENDING, TEXT
|
||||
from pymongo.errors import CollectionInvalid
|
||||
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.backend.utils import module_dispatch_registrar
|
||||
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
from planetmint import backend
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
@ -7,7 +7,7 @@
|
||||
|
||||
from functools import singledispatch
|
||||
|
||||
from bigchaindb.backend.exceptions import OperationError
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
|
||||
|
||||
@singledispatch
|
@ -8,10 +8,10 @@
|
||||
from functools import singledispatch
|
||||
import logging
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.backend.connection import connect
|
||||
from bigchaindb.common.exceptions import ValidationError
|
||||
from bigchaindb.common.utils import validate_all_values_for_key_in_obj, validate_all_values_for_key_in_list
|
||||
import planetmint
|
||||
from planetmint.backend.connection import connect
|
||||
from planetmint.common.exceptions import ValidationError
|
||||
from planetmint.common.utils import validate_all_values_for_key_in_obj, validate_all_values_for_key_in_list
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -79,7 +79,7 @@ def init_database(connection=None, dbname=None):
|
||||
"""
|
||||
|
||||
connection = connection or connect()
|
||||
dbname = dbname or bigchaindb.config['database']['name']
|
||||
dbname = dbname or planetmint.config['database']['name']
|
||||
|
||||
create_database(connection, dbname)
|
||||
create_tables(connection, dbname)
|
||||
@ -97,7 +97,7 @@ def validate_language_key(obj, key):
|
||||
Raises:
|
||||
ValidationError: will raise exception in case language is not valid.
|
||||
"""
|
||||
backend = bigchaindb.config['database']['backend']
|
||||
backend = planetmint.config['database']['backend']
|
||||
|
||||
if backend == 'localmongodb':
|
||||
data = obj.get(key, {})
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import bigchaindb
|
||||
import planetmint
|
||||
|
||||
|
||||
class ModuleDispatchRegistrationError(Exception):
|
||||
@ -32,8 +32,8 @@ def module_dispatch_registrar(module):
|
||||
|
||||
|
||||
def get_bigchaindb_config_value(key, default_value=None):
|
||||
return bigchaindb.config['database'].get(key, default_value)
|
||||
return planetmint.config['database'].get(key, default_value)
|
||||
|
||||
|
||||
def get_bigchaindb_config_value_or_key_error(key):
|
||||
return bigchaindb.config['database'][key]
|
||||
return planetmint.config['database'][key]
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
"""Implementation of the `bigchaindb` command,
|
||||
"""Implementation of the `planetmint` command,
|
||||
the command-line interface (CLI) for Planetmint Server.
|
||||
"""
|
||||
|
||||
@ -14,24 +14,24 @@ import copy
|
||||
import json
|
||||
import sys
|
||||
|
||||
from bigchaindb.core import rollback
|
||||
from bigchaindb.migrations.chain_migration_election import ChainMigrationElection
|
||||
from bigchaindb.utils import load_node_key
|
||||
from bigchaindb.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from bigchaindb.common.exceptions import (DatabaseDoesNotExist,
|
||||
from planetmint.core import rollback
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint.utils import load_node_key
|
||||
from planetmint.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from planetmint.common.exceptions import (DatabaseDoesNotExist,
|
||||
ValidationError)
|
||||
from bigchaindb.elections.vote import Vote
|
||||
import bigchaindb
|
||||
from bigchaindb import (backend, ValidatorElection,
|
||||
from planetmint.elections.vote import Vote
|
||||
import planetmint
|
||||
from planetmint import (backend, ValidatorElection,
|
||||
BigchainDB)
|
||||
from bigchaindb.backend import schema
|
||||
from bigchaindb.commands import utils
|
||||
from bigchaindb.commands.utils import (configure_bigchaindb,
|
||||
from planetmint.backend import schema
|
||||
from planetmint.commands import utils
|
||||
from planetmint.commands.utils import (configure_bigchaindb,
|
||||
input_on_stderr)
|
||||
from bigchaindb.log import setup_logging
|
||||
from bigchaindb.tendermint_utils import public_key_from_base64
|
||||
from bigchaindb.commands.election_types import elections
|
||||
from bigchaindb.version import __tm_supported_versions__
|
||||
from planetmint.log import setup_logging
|
||||
from planetmint.tendermint_utils import public_key_from_base64
|
||||
from planetmint.commands.election_types import elections
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -49,7 +49,7 @@ def run_show_config(args):
|
||||
# TODO Proposal: remove the "hidden" configuration. Only show config. If
|
||||
# the system needs to be configured, then display information on how to
|
||||
# configure the system.
|
||||
config = copy.deepcopy(bigchaindb.config)
|
||||
config = copy.deepcopy(planetmint.config)
|
||||
del config['CONFIGURED']
|
||||
print(json.dumps(config, indent=4, sort_keys=True))
|
||||
|
||||
@ -57,7 +57,7 @@ def run_show_config(args):
|
||||
@configure_bigchaindb
|
||||
def run_configure(args):
|
||||
"""Run a script to configure the current node."""
|
||||
config_path = args.config or bigchaindb.config_utils.CONFIG_DEFAULT_PATH
|
||||
config_path = args.config or planetmint.config_utils.CONFIG_DEFAULT_PATH
|
||||
|
||||
config_file_exists = False
|
||||
# if the config path is `-` then it's stdout
|
||||
@ -70,13 +70,13 @@ def run_configure(args):
|
||||
if want != 'y':
|
||||
return
|
||||
|
||||
conf = copy.deepcopy(bigchaindb.config)
|
||||
conf = copy.deepcopy(planetmint.config)
|
||||
|
||||
# select the correct config defaults based on the backend
|
||||
print('Generating default configuration for backend {}'
|
||||
.format(args.backend), file=sys.stderr)
|
||||
database_keys = bigchaindb._database_keys_map[args.backend]
|
||||
conf['database'] = bigchaindb._database_map[args.backend]
|
||||
database_keys = planetmint._database_keys_map[args.backend]
|
||||
conf['database'] = planetmint._database_map[args.backend]
|
||||
|
||||
if not args.yes:
|
||||
for key in ('bind', ):
|
||||
@ -96,7 +96,7 @@ def run_configure(args):
|
||||
conf['tendermint'][key] = input_on_stderr('Tendermint {}? (default `{}`)'.format(key, val), val)
|
||||
|
||||
if config_path != '-':
|
||||
bigchaindb.config_utils.write_config(conf, config_path)
|
||||
planetmint.config_utils.write_config(conf, config_path)
|
||||
else:
|
||||
print(json.dumps(conf, indent=4, sort_keys=True))
|
||||
print('Configuration written to {}'.format(config_path), file=sys.stderr)
|
||||
@ -241,7 +241,7 @@ def run_election_show(args, bigchain):
|
||||
|
||||
|
||||
def _run_init():
|
||||
bdb = bigchaindb.BigchainDB()
|
||||
bdb = planetmint.BigchainDB()
|
||||
|
||||
schema.init_database(connection=bdb.connection)
|
||||
|
||||
@ -255,7 +255,7 @@ def run_init(args):
|
||||
@configure_bigchaindb
|
||||
def run_drop(args):
|
||||
"""Drop the database"""
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
dbname = planetmint.config['database']['name']
|
||||
|
||||
if not args.yes:
|
||||
response = input_on_stderr('Do you want to drop `{}` database? [y/n]: '.format(dbname))
|
||||
@ -280,15 +280,15 @@ def run_start(args):
|
||||
# Configure Logging
|
||||
setup_logging()
|
||||
|
||||
logger.info('Planetmint Version %s', bigchaindb.__version__)
|
||||
run_recover(bigchaindb.lib.BigchainDB())
|
||||
logger.info('Planetmint Version %s', planetmint.__version__)
|
||||
run_recover(planetmint.lib.BigchainDB())
|
||||
|
||||
if not args.skip_initialize_database:
|
||||
logger.info('Initializing database')
|
||||
_run_init()
|
||||
|
||||
logger.info('Starting Planetmint main process.')
|
||||
from bigchaindb.start import start
|
||||
from planetmint.start import start
|
||||
start(args)
|
||||
|
||||
|
@ -13,9 +13,9 @@ import functools
|
||||
import multiprocessing as mp
|
||||
import sys
|
||||
|
||||
import bigchaindb
|
||||
import bigchaindb.config_utils
|
||||
from bigchaindb.version import __version__
|
||||
import planetmint
|
||||
import planetmint.config_utils
|
||||
from planetmint.version import __version__
|
||||
|
||||
|
||||
def configure_bigchaindb(command):
|
||||
@ -44,7 +44,7 @@ def configure_bigchaindb(command):
|
||||
}
|
||||
except AttributeError:
|
||||
pass
|
||||
bigchaindb.config_utils.autoconfigure(
|
||||
planetmint.config_utils.autoconfigure(
|
||||
filename=args.config, config=config_from_cmdline, force=True)
|
||||
command(args)
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
"""Custom exceptions used in the `bigchaindb` package.
|
||||
"""
|
||||
from bigchaindb.exceptions import BigchainDBError
|
||||
from planetmint.exceptions import BigchainDBError
|
||||
|
||||
|
||||
class ConfigurationError(BigchainDBError):
|
@ -11,7 +11,7 @@ import jsonschema
|
||||
import yaml
|
||||
import rapidjson
|
||||
|
||||
from bigchaindb.common.exceptions import SchemaValidationError
|
||||
from planetmint.common.exceptions import SchemaValidationError
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
@ -25,13 +25,13 @@ try:
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
from bigchaindb.common.crypto import PrivateKey, hash_data
|
||||
from bigchaindb.common.exceptions import (KeypairMismatchException,
|
||||
from planetmint.common.crypto import PrivateKey, hash_data
|
||||
from planetmint.common.exceptions import (KeypairMismatchException,
|
||||
InputDoesNotExist, DoubleSpend,
|
||||
InvalidHash, InvalidSignature,
|
||||
AmountError, AssetIdMismatch,
|
||||
ThresholdTooDeep)
|
||||
from bigchaindb.common.utils import serialize
|
||||
from planetmint.common.utils import serialize
|
||||
from .memoize import memoize_from_dict, memoize_to_dict
|
||||
|
||||
|
@ -7,8 +7,8 @@ import time
|
||||
import re
|
||||
import rapidjson
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.common.exceptions import ValidationError
|
||||
import planetmint
|
||||
from planetmint.common.exceptions import ValidationError
|
||||
|
||||
|
||||
def gen_timestamp():
|
||||
@ -72,7 +72,7 @@ def validate_txn_obj(obj_name, obj, key, validation_fun):
|
||||
Raises:
|
||||
ValidationError: `validation_fun` will raise exception on failure
|
||||
"""
|
||||
backend = bigchaindb.config['database']['backend']
|
||||
backend = planetmint.config['database']['backend']
|
||||
|
||||
if backend == 'localmongodb':
|
||||
data = obj.get(key, {})
|
@ -25,11 +25,11 @@ from functools import lru_cache
|
||||
|
||||
from pkg_resources import iter_entry_points, ResolutionError
|
||||
|
||||
from bigchaindb.common import exceptions
|
||||
from planetmint.common import exceptions
|
||||
|
||||
import bigchaindb
|
||||
import planetmint
|
||||
|
||||
from bigchaindb.validation import BaseValidationRules
|
||||
from planetmint.validation import BaseValidationRules
|
||||
|
||||
# TODO: move this to a proper configuration file for logging
|
||||
logging.getLogger('requests').setLevel(logging.WARNING)
|
||||
@ -37,7 +37,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_DEFAULT_PATH = os.environ.setdefault(
|
||||
'PLANETMINT_CONFIG_PATH',
|
||||
os.path.join(os.path.expanduser('~'), '.bigchaindb'),
|
||||
os.path.join(os.path.expanduser('~'), '.planetmint'),
|
||||
)
|
||||
|
||||
CONFIG_PREFIX = 'PLANETMINT'
|
||||
@ -192,10 +192,10 @@ def set_config(config):
|
||||
Any previous changes made to ``bigchaindb.config`` will be lost.
|
||||
"""
|
||||
# Deep copy the default config into bigchaindb.config
|
||||
bigchaindb.config = copy.deepcopy(bigchaindb._config)
|
||||
planetmint.config = copy.deepcopy(planetmint._config)
|
||||
# Update the default config with whatever is in the passed config
|
||||
update(bigchaindb.config, update_types(config, bigchaindb.config))
|
||||
bigchaindb.config['CONFIGURED'] = True
|
||||
update(planetmint.config, update_types(config, planetmint.config))
|
||||
planetmint.config['CONFIGURED'] = True
|
||||
|
||||
|
||||
def update_config(config):
|
||||
@ -208,8 +208,8 @@ def update_config(config):
|
||||
"""
|
||||
|
||||
# Update the default config with whatever is in the passed config
|
||||
update(bigchaindb.config, update_types(config, bigchaindb.config))
|
||||
bigchaindb.config['CONFIGURED'] = True
|
||||
update(planetmint.config, update_types(config, planetmint.config))
|
||||
planetmint.config['CONFIGURED'] = True
|
||||
|
||||
|
||||
def write_config(config, filename=None):
|
||||
@ -228,7 +228,7 @@ def write_config(config, filename=None):
|
||||
|
||||
|
||||
def is_configured():
|
||||
return bool(bigchaindb.config.get('CONFIGURED'))
|
||||
return bool(planetmint.config.get('CONFIGURED'))
|
||||
|
||||
|
||||
def autoconfigure(filename=None, config=None, force=False):
|
||||
@ -240,7 +240,7 @@ def autoconfigure(filename=None, config=None, force=False):
|
||||
return
|
||||
|
||||
# start with the current configuration
|
||||
newconfig = bigchaindb.config
|
||||
newconfig = planetmint.config
|
||||
|
||||
# update configuration from file
|
||||
try:
|
@ -12,15 +12,15 @@ import sys
|
||||
from abci.application import BaseApplication
|
||||
from abci import CodeTypeOk
|
||||
|
||||
from bigchaindb import BigchainDB
|
||||
from bigchaindb.elections.election import Election
|
||||
from bigchaindb.version import __tm_supported_versions__
|
||||
from bigchaindb.utils import tendermint_version_is_compatible
|
||||
from bigchaindb.tendermint_utils import (decode_transaction,
|
||||
from planetmint import BigchainDB
|
||||
from planetmint.elections.election import Election
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
from planetmint.utils import tendermint_version_is_compatible
|
||||
from planetmint.tendermint_utils import (decode_transaction,
|
||||
calculate_hash)
|
||||
from bigchaindb.lib import Block
|
||||
import bigchaindb.upsert_validator.validator_utils as vutils
|
||||
from bigchaindb.events import EventTypes, Event
|
||||
from planetmint.lib import Block
|
||||
import planetmint.upsert_validator.validator_utils as vutils
|
||||
from planetmint.events import EventTypes, Event
|
||||
|
||||
|
||||
CodeTypeError = 1
|
@ -7,17 +7,17 @@ from collections import OrderedDict
|
||||
import base58
|
||||
from uuid import uuid4
|
||||
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.elections.vote import Vote
|
||||
from bigchaindb.common.exceptions import (InvalidSignature,
|
||||
from planetmint import backend
|
||||
from planetmint.elections.vote import Vote
|
||||
from planetmint.common.exceptions import (InvalidSignature,
|
||||
MultipleInputsError,
|
||||
InvalidProposer,
|
||||
UnequalValidatorSet,
|
||||
DuplicateTransaction)
|
||||
from bigchaindb.tendermint_utils import key_from_base64, public_key_to_base64
|
||||
from bigchaindb.common.crypto import (public_key_from_ed25519_key)
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.schema import (_validate_schema,
|
||||
from planetmint.tendermint_utils import key_from_base64, public_key_to_base64
|
||||
from planetmint.common.crypto import (public_key_from_ed25519_key)
|
||||
from planetmint.common.transaction import Transaction
|
||||
from planetmint.common.schema import (_validate_schema,
|
||||
TX_SCHEMA_COMMON,
|
||||
TX_SCHEMA_CREATE)
|
||||
|
@ -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
|
||||
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.schema import (_validate_schema,
|
||||
from planetmint.common.transaction import Transaction
|
||||
from planetmint.common.schema import (_validate_schema,
|
||||
TX_SCHEMA_COMMON,
|
||||
TX_SCHEMA_TRANSFER,
|
||||
TX_SCHEMA_VOTE)
|
@ -3,9 +3,9 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from bigchaindb.utils import condition_details_has_owner
|
||||
from bigchaindb.backend import query
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.utils import condition_details_has_owner
|
||||
from planetmint.backend import query
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
|
||||
class FastQuery():
|
@ -21,18 +21,18 @@ except ImportError:
|
||||
|
||||
import requests
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb import backend, config_utils, fastquery
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import (SchemaValidationError,
|
||||
import planetmint
|
||||
from planetmint import backend, config_utils, fastquery
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.exceptions import (SchemaValidationError,
|
||||
ValidationError,
|
||||
DoubleSpend)
|
||||
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
from planetmint.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC)
|
||||
from bigchaindb.tendermint_utils import encode_transaction, merkleroot
|
||||
from bigchaindb import exceptions as core_exceptions
|
||||
from bigchaindb.validation import BaseValidationRules
|
||||
from planetmint.tendermint_utils import encode_transaction, merkleroot
|
||||
from planetmint import exceptions as core_exceptions
|
||||
from planetmint.validation import BaseValidationRules
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -65,18 +65,18 @@ class BigchainDB(object):
|
||||
self.mode_list = (BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC,
|
||||
self.mode_commit)
|
||||
self.tendermint_host = bigchaindb.config['tendermint']['host']
|
||||
self.tendermint_port = bigchaindb.config['tendermint']['port']
|
||||
self.tendermint_host = planetmint.config['tendermint']['host']
|
||||
self.tendermint_port = planetmint.config['tendermint']['port']
|
||||
self.endpoint = 'http://{}:{}/'.format(self.tendermint_host, self.tendermint_port)
|
||||
|
||||
validationPlugin = bigchaindb.config.get('validation_plugin')
|
||||
validationPlugin = planetmint.config.get('validation_plugin')
|
||||
|
||||
if validationPlugin:
|
||||
self.validation = config_utils.load_validation_plugin(validationPlugin)
|
||||
else:
|
||||
self.validation = BaseValidationRules
|
||||
|
||||
self.connection = connection if connection else backend.connect(**bigchaindb.config['database'])
|
||||
self.connection = connection if connection else backend.connect(**planetmint.config['database'])
|
||||
|
||||
def post_transaction(self, transaction, mode):
|
||||
"""Submit a valid transaction to the mempool."""
|
@ -3,10 +3,10 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import bigchaindb
|
||||
import planetmint
|
||||
import logging
|
||||
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from planetmint.common.exceptions import ConfigurationError
|
||||
from logging.config import dictConfig as set_logging_config
|
||||
import os
|
||||
|
||||
@ -84,7 +84,7 @@ def setup_logging():
|
||||
"""
|
||||
|
||||
logging_configs = DEFAULT_LOGGING_CONFIG
|
||||
new_logging_configs = bigchaindb.config['log']
|
||||
new_logging_configs = planetmint.config['log']
|
||||
|
||||
if 'file' in new_logging_configs:
|
||||
filename = new_logging_configs['file']
|
@ -1,7 +1,7 @@
|
||||
import json
|
||||
|
||||
from bigchaindb.common.schema import TX_SCHEMA_CHAIN_MIGRATION_ELECTION
|
||||
from bigchaindb.elections.election import Election
|
||||
from planetmint.common.schema import TX_SCHEMA_CHAIN_MIGRATION_ELECTION
|
||||
from planetmint.elections.election import Election
|
||||
|
||||
|
||||
class ChainMigrationElection(Election):
|
@ -3,12 +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
|
||||
|
||||
from bigchaindb.backend.schema import validate_language_key
|
||||
from bigchaindb.common.exceptions import (InvalidSignature,
|
||||
from planetmint.backend.schema import validate_language_key
|
||||
from planetmint.common.exceptions import (InvalidSignature,
|
||||
DuplicateTransaction)
|
||||
from bigchaindb.common.schema import validate_transaction_schema
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.utils import (validate_txn_obj, validate_key)
|
||||
from planetmint.common.schema import validate_transaction_schema
|
||||
from planetmint.common.transaction import Transaction
|
||||
from planetmint.common.utils import (validate_txn_obj, validate_key)
|
||||
|
||||
|
||||
class Transaction(Transaction):
|
@ -6,8 +6,8 @@
|
||||
import multiprocessing as mp
|
||||
from collections import defaultdict
|
||||
|
||||
from bigchaindb import App, BigchainDB
|
||||
from bigchaindb.tendermint_utils import decode_transaction
|
||||
from planetmint import App, BigchainDB
|
||||
from planetmint.tendermint_utils import decode_transaction
|
||||
from abci import CodeTypeOk
|
||||
|
||||
|
@ -8,13 +8,13 @@ import setproctitle
|
||||
|
||||
from abci import TmVersion, ABCI
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.lib import BigchainDB
|
||||
from bigchaindb.core import App
|
||||
from bigchaindb.parallel_validation import ParallelValidationApp
|
||||
from bigchaindb.web import server, websocket_server
|
||||
from bigchaindb.events import Exchange, EventTypes
|
||||
from bigchaindb.utils import Process
|
||||
import planetmint
|
||||
from planetmint.lib import BigchainDB
|
||||
from planetmint.core import App
|
||||
from planetmint.parallel_validation import ParallelValidationApp
|
||||
from planetmint.web import server, websocket_server
|
||||
from planetmint.events import Exchange, EventTypes
|
||||
from planetmint.utils import Process
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -42,22 +42,22 @@ def start(args):
|
||||
exchange = Exchange()
|
||||
# start the web api
|
||||
app_server = server.create_server(
|
||||
settings=bigchaindb.config['server'],
|
||||
log_config=bigchaindb.config['log'],
|
||||
settings=planetmint.config['server'],
|
||||
log_config=planetmint.config['log'],
|
||||
bigchaindb_factory=BigchainDB)
|
||||
p_webapi = Process(name='bigchaindb_webapi', target=app_server.run, daemon=True)
|
||||
p_webapi = Process(name='planetmint_webapi', target=app_server.run, daemon=True)
|
||||
p_webapi.start()
|
||||
|
||||
logger.info(BANNER.format(bigchaindb.config['server']['bind']))
|
||||
logger.info(BANNER.format(planetmint.config['server']['bind']))
|
||||
|
||||
# start websocket server
|
||||
p_websocket_server = Process(name='bigchaindb_ws',
|
||||
p_websocket_server = Process(name='planetmint_ws',
|
||||
target=websocket_server.start,
|
||||
daemon=True,
|
||||
args=(exchange.get_subscriber_queue(EventTypes.BLOCK_VALID),))
|
||||
p_websocket_server.start()
|
||||
|
||||
p_exchange = Process(name='bigchaindb_exchange', target=exchange.run, daemon=True)
|
||||
p_exchange = Process(name='planetmint_exchange', target=exchange.run, daemon=True)
|
||||
p_exchange.start()
|
||||
|
||||
# We need to import this after spawning the web server
|
||||
@ -65,10 +65,10 @@ def start(args):
|
||||
# for gevent.
|
||||
from abci.server import ABCIServer
|
||||
|
||||
setproctitle.setproctitle('bigchaindb')
|
||||
setproctitle.setproctitle('planetmint')
|
||||
|
||||
# Start the ABCIServer
|
||||
abci = ABCI(TmVersion(bigchaindb.config['tendermint']['version']))
|
||||
abci = ABCI(TmVersion(planetmint.config['tendermint']['version']))
|
||||
if args.experimental_parallel_validation:
|
||||
app = ABCIServer(
|
||||
app=ParallelValidationApp(
|
@ -4,4 +4,4 @@
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
||||
from bigchaindb.upsert_validator.validator_election import ValidatorElection # noqa
|
||||
from planetmint.upsert_validator.validator_election import ValidatorElection # noqa
|
@ -3,9 +3,9 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from bigchaindb.common.exceptions import InvalidPowerChange
|
||||
from bigchaindb.elections.election import Election
|
||||
from bigchaindb.common.schema import TX_SCHEMA_VALIDATOR_ELECTION
|
||||
from planetmint.common.exceptions import InvalidPowerChange
|
||||
from planetmint.elections.election import Election
|
||||
from planetmint.common.schema import TX_SCHEMA_VALIDATOR_ELECTION
|
||||
from .validator_utils import (new_validator_set, encode_validator, validate_asset_public_key)
|
||||
|
||||
|
@ -2,16 +2,16 @@ import base64
|
||||
import binascii
|
||||
import codecs
|
||||
|
||||
import bigchaindb
|
||||
import planetmint
|
||||
from abci import types_v0_22_8, types_v0_31_5, TmVersion
|
||||
from bigchaindb.common.exceptions import InvalidPublicKey, BigchainDBError
|
||||
from planetmint.common.exceptions import InvalidPublicKey, BigchainDBError
|
||||
|
||||
|
||||
def encode_validator(v):
|
||||
ed25519_public_key = v['public_key']['value']
|
||||
# NOTE: tendermint expects public to be encoded in go-amino format
|
||||
try:
|
||||
version = TmVersion(bigchaindb.config["tendermint"]["version"])
|
||||
version = TmVersion(planetmint.config["tendermint"]["version"])
|
||||
except ValueError:
|
||||
raise BigchainDBError('Invalid tendermint version, '
|
||||
'check Planetmint configuration file')
|
@ -11,9 +11,9 @@ import json
|
||||
|
||||
import setproctitle
|
||||
from packaging import version
|
||||
from bigchaindb.version import __tm_supported_versions__
|
||||
from bigchaindb.tendermint_utils import key_from_base64
|
||||
from bigchaindb.common.crypto import key_pair_from_ed25519_key
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
from planetmint.tendermint_utils import key_from_base64
|
||||
from planetmint.common.crypto import key_pair_from_ed25519_key
|
||||
|
||||
|
||||
class ProcessGroup(object):
|
@ -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__ = '2.2.2'
|
||||
__short_version__ = '2.2'
|
||||
__version__ = '0.9.0'
|
||||
__short_version__ = '0.9'
|
||||
|
||||
# Supported Tendermint versions
|
||||
__tm_supported_versions__ = ["0.31.5", "0.22.8"]
|
@ -5,7 +5,7 @@
|
||||
|
||||
"""API routes definition"""
|
||||
from flask_restful import Api
|
||||
from bigchaindb.web.views import (
|
||||
from planetmint.web.views import (
|
||||
assets,
|
||||
metadata,
|
||||
blocks,
|
@ -15,10 +15,10 @@ from flask import Flask
|
||||
from flask_cors import CORS
|
||||
import gunicorn.app.base
|
||||
|
||||
from bigchaindb import utils
|
||||
from bigchaindb import BigchainDB
|
||||
from bigchaindb.web.routes import add_routes
|
||||
from bigchaindb.web.strip_content_type_middleware import StripContentTypeMiddleware
|
||||
from planetmint import utils
|
||||
from planetmint import BigchainDB
|
||||
from planetmint.web.routes import add_routes
|
||||
from planetmint.web.strip_content_type_middleware import StripContentTypeMiddleware
|
||||
|
||||
|
||||
# TODO: Figure out if we do we need all this boilerplate.
|
@ -12,8 +12,8 @@ import logging
|
||||
from flask_restful import reqparse, Resource
|
||||
from flask import current_app
|
||||
|
||||
from bigchaindb.backend.exceptions import OperationError
|
||||
from bigchaindb.web.views.base import make_error
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -9,7 +9,7 @@ import logging
|
||||
|
||||
from flask import jsonify, request
|
||||
|
||||
from bigchaindb import config
|
||||
from planetmint import config
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
@ -10,7 +10,7 @@ For more information please refer to the documentation: http://bigchaindb.com/ht
|
||||
from flask import current_app
|
||||
from flask_restful import Resource, reqparse
|
||||
|
||||
from bigchaindb.web.views.base import make_error
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
|
||||
class BlockApi(Resource):
|
@ -8,9 +8,9 @@
|
||||
import flask
|
||||
from flask_restful import Resource
|
||||
|
||||
from bigchaindb.web.views.base import base_ws_uri
|
||||
from bigchaindb import version
|
||||
from bigchaindb.web.websocket_server import EVENTS_ENDPOINT
|
||||
from planetmint.web.views.base import base_ws_uri
|
||||
from planetmint import version
|
||||
from planetmint.web.websocket_server import EVENTS_ENDPOINT
|
||||
|
||||
|
||||
class RootIndex(Resource):
|
@ -12,8 +12,8 @@ import logging
|
||||
from flask_restful import reqparse, Resource
|
||||
from flask import current_app
|
||||
|
||||
from bigchaindb.backend.exceptions import OperationError
|
||||
from bigchaindb.web.views.base import make_error
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
from planetmint.web.views.base import make_error
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -6,7 +6,7 @@
|
||||
from flask import current_app
|
||||
from flask_restful import reqparse, Resource
|
||||
|
||||
from bigchaindb.web.views import parameters
|
||||
from planetmint.web.views import parameters
|
||||
|
||||
|
||||
class OutputListApi(Resource):
|
@ -5,7 +5,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
from planetmint.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC)
|
||||
|
@ -12,11 +12,11 @@ import logging
|
||||
from flask import current_app, request, jsonify
|
||||
from flask_restful import Resource, reqparse
|
||||
|
||||
from bigchaindb.common.transaction_mode_types import BROADCAST_TX_ASYNC
|
||||
from bigchaindb.common.exceptions import SchemaValidationError, ValidationError
|
||||
from bigchaindb.web.views.base import make_error
|
||||
from bigchaindb.web.views import parameters
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.transaction_mode_types import BROADCAST_TX_ASYNC
|
||||
from planetmint.common.exceptions import SchemaValidationError, ValidationError
|
||||
from planetmint.web.views.base import make_error
|
||||
from planetmint.web.views import parameters
|
||||
from planetmint.models import Transaction
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
@ -26,8 +26,8 @@ from concurrent.futures import CancelledError
|
||||
import aiohttp
|
||||
from aiohttp import web
|
||||
|
||||
from bigchaindb import config
|
||||
from bigchaindb.events import EventTypes
|
||||
from planetmint import config
|
||||
from planetmint.events import EventTypes
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
6
setup.py
6
setup.py
@ -18,7 +18,7 @@ if sys.version_info < (3, 6):
|
||||
|
||||
# get the version
|
||||
version = {}
|
||||
with open('bigchaindb/version.py') as fp:
|
||||
with open('planetmint/version.py') as fp:
|
||||
exec(fp.read(), version)
|
||||
|
||||
def check_setuptools_features():
|
||||
@ -134,7 +134,7 @@ setup(
|
||||
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'bigchaindb=bigchaindb.commands.bigchaindb:main'
|
||||
'planetmint=planetmint.commands.planetmint:main'
|
||||
],
|
||||
},
|
||||
install_requires=install_requires,
|
||||
@ -145,5 +145,5 @@ setup(
|
||||
'dev': dev_require + tests_require + docs_require,
|
||||
'docs': docs_require,
|
||||
},
|
||||
package_data={'bigchaindb.common.schema': ['*.yaml']},
|
||||
package_data={'planetmint.common.schema': ['*.yaml']},
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ import random
|
||||
|
||||
|
||||
def test_asset_transfer(b, signed_create_tx, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx_transfer = Transaction.transfer(signed_create_tx.to_inputs(), [([user_pk], 1)],
|
||||
signed_create_tx.id)
|
||||
@ -21,8 +21,8 @@ def test_asset_transfer(b, signed_create_tx, user_pk, user_sk):
|
||||
|
||||
|
||||
def test_validate_transfer_asset_id_mismatch(b, signed_create_tx, user_pk, user_sk):
|
||||
from bigchaindb.common.exceptions import AssetIdMismatch
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.exceptions import AssetIdMismatch
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx_transfer = Transaction.transfer(signed_create_tx.to_inputs(), [([user_pk], 1)],
|
||||
signed_create_tx.id)
|
||||
@ -36,13 +36,13 @@ def test_validate_transfer_asset_id_mismatch(b, signed_create_tx, user_pk, user_
|
||||
|
||||
|
||||
def test_get_asset_id_create_transaction(alice, user_pk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 1)])
|
||||
assert Transaction.get_asset_id(tx_create) == tx_create.id
|
||||
|
||||
|
||||
def test_get_asset_id_transfer_transaction(b, signed_create_tx, user_pk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx_transfer = Transaction.transfer(signed_create_tx.to_inputs(), [([user_pk], 1)],
|
||||
signed_create_tx.id)
|
||||
@ -51,8 +51,8 @@ def test_get_asset_id_transfer_transaction(b, signed_create_tx, user_pk):
|
||||
|
||||
|
||||
def test_asset_id_mismatch(alice, user_pk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import AssetIdMismatch
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.exceptions import AssetIdMismatch
|
||||
|
||||
tx1 = Transaction.create([alice.public_key], [([user_pk], 1)],
|
||||
metadata={'msg': random.random()})
|
||||
@ -66,7 +66,7 @@ def test_asset_id_mismatch(alice, user_pk):
|
||||
|
||||
|
||||
def test_create_valid_divisible_asset(b, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx = Transaction.create([user_pk], [([user_pk], 2)])
|
||||
tx_signed = tx.sign([user_sk])
|
||||
|
@ -6,7 +6,7 @@
|
||||
import pytest
|
||||
import random
|
||||
|
||||
from bigchaindb.common.exceptions import DoubleSpend
|
||||
from planetmint.common.exceptions import DoubleSpend
|
||||
|
||||
|
||||
# CREATE divisible asset
|
||||
@ -15,7 +15,7 @@ from bigchaindb.common.exceptions import DoubleSpend
|
||||
# Single output
|
||||
# Single owners_after
|
||||
def test_single_in_single_own_single_out_single_own_create(alice, user_pk, b):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
tx_signed = tx.sign([alice.private_key])
|
||||
@ -32,7 +32,7 @@ def test_single_in_single_own_single_out_single_own_create(alice, user_pk, b):
|
||||
# Multiple outputs
|
||||
# Single owners_after per output
|
||||
def test_single_in_single_own_multiple_out_single_own_create(alice, user_pk, b):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk], 50)],
|
||||
asset={'name': random.random()})
|
||||
@ -51,7 +51,7 @@ def test_single_in_single_own_multiple_out_single_own_create(alice, user_pk, b):
|
||||
# Single output
|
||||
# Multiple owners_after
|
||||
def test_single_in_single_own_single_out_multiple_own_create(alice, user_pk, b):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([user_pk, user_pk], 100)], asset={'name': random.random()})
|
||||
tx_signed = tx.sign([alice.private_key])
|
||||
@ -74,7 +74,7 @@ def test_single_in_single_own_single_out_multiple_own_create(alice, user_pk, b):
|
||||
# Mix: one output with a single owners_after, one output with multiple
|
||||
# owners_after
|
||||
def test_single_in_single_own_multiple_out_mix_own_create(alice, user_pk, b):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk, user_pk], 50)],
|
||||
asset={'name': random.random()})
|
||||
@ -98,8 +98,8 @@ def test_single_in_single_own_multiple_out_mix_own_create(alice, user_pk, b):
|
||||
# Output combinations already tested above
|
||||
def test_single_in_multiple_own_single_out_single_own_create(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.transaction import _fulfillment_to_details
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.transaction import _fulfillment_to_details
|
||||
|
||||
tx = Transaction.create([alice.public_key, user_pk], [([user_pk], 100)], asset={'name': random.random()})
|
||||
tx_signed = tx.sign([alice.private_key, user_sk])
|
||||
@ -120,7 +120,7 @@ def test_single_in_multiple_own_single_out_single_own_create(alice, b, user_pk,
|
||||
# Single owners_after
|
||||
def test_single_in_single_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -146,7 +146,7 @@ def test_single_in_single_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
# Single owners_after
|
||||
def test_single_in_single_own_multiple_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -174,7 +174,7 @@ def test_single_in_single_own_multiple_out_single_own_transfer(alice, b, user_pk
|
||||
# Multiple owners_after
|
||||
def test_single_in_single_own_single_out_multiple_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -211,7 +211,7 @@ def test_single_in_single_own_single_out_multiple_own_transfer(alice, b, user_pk
|
||||
# owners_after
|
||||
def test_single_in_single_own_multiple_out_mix_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -248,8 +248,8 @@ def test_single_in_single_own_multiple_out_mix_own_transfer(alice, b, user_pk,
|
||||
# Single owners_after
|
||||
def test_single_in_multiple_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.transaction import _fulfillment_to_details
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.transaction import _fulfillment_to_details
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([alice.public_key, user_pk], 100)],
|
||||
@ -284,7 +284,7 @@ def test_single_in_multiple_own_single_out_single_own_transfer(alice, b, user_pk
|
||||
# Single owners_after
|
||||
def test_multiple_in_single_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk], 50)],
|
||||
@ -315,8 +315,8 @@ def test_multiple_in_single_own_single_out_single_own_transfer(alice, b, user_pk
|
||||
# Single owners_after
|
||||
def test_multiple_in_multiple_own_single_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.transaction import _fulfillment_to_details
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.transaction import _fulfillment_to_details
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk, alice.public_key], 50),
|
||||
@ -356,8 +356,8 @@ def test_multiple_in_multiple_own_single_out_single_own_transfer(alice, b, user_
|
||||
# Single owners_after
|
||||
def test_muiltiple_in_mix_own_multiple_out_single_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.transaction import _fulfillment_to_details
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.transaction import _fulfillment_to_details
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk, alice.public_key], 50)],
|
||||
@ -396,8 +396,8 @@ def test_muiltiple_in_mix_own_multiple_out_single_own_transfer(alice, b, user_pk
|
||||
# owners_after
|
||||
def test_muiltiple_in_mix_own_multiple_out_mix_own_transfer(alice, b, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.transaction import _fulfillment_to_details
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.transaction import _fulfillment_to_details
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 50), ([user_pk, alice.public_key], 50)],
|
||||
@ -441,7 +441,7 @@ def test_muiltiple_in_mix_own_multiple_out_mix_own_transfer(alice, b, user_pk,
|
||||
# Single output
|
||||
# Single owners_after
|
||||
def test_multiple_in_different_transactions(alice, b, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
# `b` creates a divisible asset and assigns 50 shares to `b` and
|
||||
@ -485,8 +485,8 @@ def test_multiple_in_different_transactions(alice, b, user_pk, user_sk):
|
||||
# inputs needs to match the amount being sent in the outputs.
|
||||
# In other words `amount_in_inputs - amount_in_outputs == 0`
|
||||
def test_amount_error_transfer(alice, b, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import AmountError
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.exceptions import AmountError
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 100)], asset={'name': random.random()})
|
||||
@ -521,7 +521,7 @@ def test_threshold_same_public_key(alice, b, user_pk, user_sk):
|
||||
# Creating threshold conditions with the same key does not make sense but
|
||||
# that does not mean that the code shouldn't work.
|
||||
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk, user_pk], 100)],
|
||||
@ -543,7 +543,7 @@ def test_threshold_same_public_key(alice, b, user_pk, user_sk):
|
||||
|
||||
|
||||
def test_sum_amount(alice, b, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset with 3 outputs with amount 1
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 1), ([user_pk], 1), ([user_pk], 1)],
|
||||
@ -568,7 +568,7 @@ def test_sum_amount(alice, b, user_pk, user_sk):
|
||||
|
||||
|
||||
def test_divide(alice, b, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# CREATE divisible asset with 1 output with amount 3
|
||||
tx_create = Transaction.create([alice.public_key], [([user_pk], 3)], asset={'name': random.random()})
|
||||
|
@ -31,15 +31,15 @@ def mock_config_opts():
|
||||
|
||||
@pytest.fixture
|
||||
def mongodb_connection():
|
||||
import bigchaindb
|
||||
return MongoClient(host=bigchaindb.config['database']['host'],
|
||||
port=bigchaindb.config['database']['port'])
|
||||
import planetmint
|
||||
return MongoClient(host=planetmint.config['database']['host'],
|
||||
port=planetmint.config['database']['port'])
|
||||
|
||||
|
||||
def test_get_connection_returns_the_correct_instance(db_host, db_port):
|
||||
from bigchaindb.backend import connect
|
||||
from bigchaindb.backend.connection import Connection
|
||||
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
from planetmint.backend import connect
|
||||
from planetmint.backend.connection import Connection
|
||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
|
||||
config = {
|
||||
'backend': 'localmongodb',
|
||||
@ -57,8 +57,8 @@ def test_get_connection_returns_the_correct_instance(db_host, db_port):
|
||||
|
||||
@mock.patch('pymongo.MongoClient.__init__')
|
||||
def test_connection_error(mock_client):
|
||||
from bigchaindb.backend import connect
|
||||
from bigchaindb.backend.exceptions import ConnectionError
|
||||
from planetmint.backend import connect
|
||||
from planetmint.backend.exceptions import ConnectionError
|
||||
|
||||
# force the driver to throw ConnectionFailure
|
||||
# the mock on time.sleep is to prevent the actual sleep when running
|
||||
@ -73,8 +73,8 @@ def test_connection_error(mock_client):
|
||||
|
||||
|
||||
def test_connection_run_errors():
|
||||
from bigchaindb.backend import connect
|
||||
from bigchaindb.backend.exceptions import (DuplicateKeyError,
|
||||
from planetmint.backend import connect
|
||||
from planetmint.backend.exceptions import (DuplicateKeyError,
|
||||
OperationError,
|
||||
ConnectionError)
|
||||
|
||||
@ -101,10 +101,10 @@ def test_connection_run_errors():
|
||||
|
||||
@mock.patch('pymongo.database.Database.authenticate')
|
||||
def test_connection_with_credentials(mock_authenticate):
|
||||
import bigchaindb
|
||||
from bigchaindb.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
conn = LocalMongoDBConnection(host=bigchaindb.config['database']['host'],
|
||||
port=bigchaindb.config['database']['port'],
|
||||
import planetmint
|
||||
from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
conn = LocalMongoDBConnection(host=planetmint.config['database']['host'],
|
||||
port=planetmint.config['database']['port'],
|
||||
login='theplague',
|
||||
password='secret')
|
||||
conn.connect()
|
||||
|
@ -8,15 +8,15 @@ from copy import deepcopy
|
||||
import pytest
|
||||
import pymongo
|
||||
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
|
||||
|
||||
pytestmark = pytest.mark.bdb
|
||||
|
||||
|
||||
def test_get_txids_filtered(signed_create_tx, signed_transfer_tx):
|
||||
from bigchaindb.backend import connect, query
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.backend import connect, query
|
||||
from planetmint.models import Transaction
|
||||
conn = connect()
|
||||
|
||||
# create and insert two blocks, one for the create and one for the
|
||||
@ -40,7 +40,7 @@ def test_get_txids_filtered(signed_create_tx, signed_transfer_tx):
|
||||
|
||||
|
||||
def test_write_assets():
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
assets = [
|
||||
@ -64,7 +64,7 @@ def test_write_assets():
|
||||
|
||||
|
||||
def test_get_assets():
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
assets = [
|
||||
@ -81,7 +81,7 @@ def test_get_assets():
|
||||
|
||||
@pytest.mark.parametrize('table', ['assets', 'metadata'])
|
||||
def test_text_search(table):
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
# Example data and tests cases taken from the mongodb documentation
|
||||
@ -165,7 +165,7 @@ def test_text_search(table):
|
||||
|
||||
|
||||
def test_write_metadata():
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
metadata = [
|
||||
@ -186,7 +186,7 @@ def test_write_metadata():
|
||||
|
||||
|
||||
def test_get_metadata():
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
metadata = [
|
||||
@ -202,7 +202,7 @@ def test_get_metadata():
|
||||
|
||||
|
||||
def test_get_owned_ids(signed_create_tx, user_pk):
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
conn = connect()
|
||||
|
||||
# insert a transaction
|
||||
@ -214,8 +214,8 @@ def test_get_owned_ids(signed_create_tx, user_pk):
|
||||
|
||||
|
||||
def test_get_spending_transactions(user_pk, user_sk):
|
||||
from bigchaindb.backend import connect, query
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.backend import connect, query
|
||||
from planetmint.models import Transaction
|
||||
conn = connect()
|
||||
|
||||
out = [([user_pk], 1)]
|
||||
@ -236,9 +236,9 @@ def test_get_spending_transactions(user_pk, user_sk):
|
||||
|
||||
|
||||
def test_get_spending_transactions_multiple_inputs():
|
||||
from bigchaindb.backend import connect, query
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from planetmint.backend import connect, query
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
conn = connect()
|
||||
(alice_sk, alice_pk) = generate_key_pair()
|
||||
(bob_sk, bob_pk) = generate_key_pair()
|
||||
@ -279,8 +279,8 @@ def test_get_spending_transactions_multiple_inputs():
|
||||
|
||||
|
||||
def test_store_block():
|
||||
from bigchaindb.backend import connect, query
|
||||
from bigchaindb.lib import Block
|
||||
from planetmint.backend import connect, query
|
||||
from planetmint.lib import Block
|
||||
conn = connect()
|
||||
|
||||
block = Block(app_hash='random_utxo',
|
||||
@ -292,8 +292,8 @@ def test_store_block():
|
||||
|
||||
|
||||
def test_get_block():
|
||||
from bigchaindb.backend import connect, query
|
||||
from bigchaindb.lib import Block
|
||||
from planetmint.backend import connect, query
|
||||
from planetmint.lib import Block
|
||||
conn = connect()
|
||||
|
||||
block = Block(app_hash='random_utxo',
|
||||
@ -307,7 +307,7 @@ def test_get_block():
|
||||
|
||||
|
||||
def test_delete_zero_unspent_outputs(db_context, utxoset):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
unspent_outputs, utxo_collection = utxoset
|
||||
delete_res = query.delete_unspent_outputs(db_context.conn)
|
||||
assert delete_res is None
|
||||
@ -322,7 +322,7 @@ def test_delete_zero_unspent_outputs(db_context, utxoset):
|
||||
|
||||
|
||||
def test_delete_one_unspent_outputs(db_context, utxoset):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
unspent_outputs, utxo_collection = utxoset
|
||||
delete_res = query.delete_unspent_outputs(db_context.conn,
|
||||
unspent_outputs[0])
|
||||
@ -338,7 +338,7 @@ def test_delete_one_unspent_outputs(db_context, utxoset):
|
||||
|
||||
|
||||
def test_delete_many_unspent_outputs(db_context, utxoset):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
unspent_outputs, utxo_collection = utxoset
|
||||
delete_res = query.delete_unspent_outputs(db_context.conn,
|
||||
*unspent_outputs[::2])
|
||||
@ -354,7 +354,7 @@ def test_delete_many_unspent_outputs(db_context, utxoset):
|
||||
|
||||
|
||||
def test_store_zero_unspent_output(db_context, utxo_collection):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
res = query.store_unspent_outputs(db_context.conn)
|
||||
assert res is None
|
||||
assert utxo_collection.count_documents({}) == 0
|
||||
@ -362,7 +362,7 @@ def test_store_zero_unspent_output(db_context, utxo_collection):
|
||||
|
||||
def test_store_one_unspent_output(db_context,
|
||||
unspent_output_1, utxo_collection):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
res = query.store_unspent_outputs(db_context.conn, unspent_output_1)
|
||||
assert res.acknowledged
|
||||
assert len(res.inserted_ids) == 1
|
||||
@ -374,7 +374,7 @@ def test_store_one_unspent_output(db_context,
|
||||
|
||||
def test_store_many_unspent_outputs(db_context,
|
||||
unspent_outputs, utxo_collection):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
res = query.store_unspent_outputs(db_context.conn, *unspent_outputs)
|
||||
assert res.acknowledged
|
||||
assert len(res.inserted_ids) == 3
|
||||
@ -384,7 +384,7 @@ def test_store_many_unspent_outputs(db_context,
|
||||
|
||||
|
||||
def test_get_unspent_outputs(db_context, utxoset):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
cursor = query.get_unspent_outputs(db_context.conn)
|
||||
assert cursor.collection.count_documents({}) == 3
|
||||
retrieved_utxoset = list(cursor)
|
||||
@ -395,7 +395,7 @@ def test_get_unspent_outputs(db_context, utxoset):
|
||||
|
||||
|
||||
def test_store_pre_commit_state(db_context):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
|
||||
state = dict(height=3, transactions=[])
|
||||
|
||||
@ -406,7 +406,7 @@ def test_store_pre_commit_state(db_context):
|
||||
|
||||
|
||||
def test_get_pre_commit_state(db_context):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
|
||||
state = dict(height=3, transactions=[])
|
||||
db_context.conn.db.pre_commit.insert_one(state)
|
||||
@ -415,7 +415,7 @@ def test_get_pre_commit_state(db_context):
|
||||
|
||||
|
||||
def test_validator_update():
|
||||
from bigchaindb.backend import connect, query
|
||||
from planetmint.backend import connect, query
|
||||
|
||||
conn = connect()
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
|
||||
def test_init_database_is_graceful_if_db_exists():
|
||||
import bigchaindb
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.backend.schema import init_database
|
||||
import planetmint
|
||||
from planetmint import backend
|
||||
from planetmint.backend.schema import init_database
|
||||
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
dbname = planetmint.config['database']['name']
|
||||
|
||||
# The db is set up by the fixtures
|
||||
assert dbname in conn.conn.list_database_names()
|
||||
@ -19,12 +19,12 @@ def test_init_database_is_graceful_if_db_exists():
|
||||
|
||||
|
||||
def test_create_tables():
|
||||
import bigchaindb
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.backend import schema
|
||||
import planetmint
|
||||
from planetmint import backend
|
||||
from planetmint.backend import schema
|
||||
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
dbname = planetmint.config['database']['name']
|
||||
|
||||
# The db is set up by the fixtures so we need to remove it
|
||||
conn.conn.drop_database(dbname)
|
||||
@ -67,8 +67,8 @@ def test_create_tables():
|
||||
|
||||
|
||||
def test_drop(dummy_db):
|
||||
from bigchaindb import backend
|
||||
from bigchaindb.backend import schema
|
||||
from planetmint import backend
|
||||
from planetmint.backend import schema
|
||||
|
||||
conn = backend.connect()
|
||||
assert dummy_db in conn.conn.list_database_names()
|
||||
|
@ -7,8 +7,8 @@ import pytest
|
||||
|
||||
|
||||
def test_get_connection_raises_a_configuration_error(monkeypatch):
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from bigchaindb.backend import connect
|
||||
from planetmint.common.exceptions import ConfigurationError
|
||||
from planetmint.backend import connect
|
||||
|
||||
with pytest.raises(ConfigurationError):
|
||||
connect('msaccess', 'localhost', '1337', 'mydb')
|
||||
|
@ -12,7 +12,7 @@ from pytest import mark, raises
|
||||
('drop_database', 1),
|
||||
))
|
||||
def test_schema(schema_func_name, args_qty):
|
||||
from bigchaindb.backend import schema
|
||||
from planetmint.backend import schema
|
||||
schema_func = getattr(schema, schema_func_name)
|
||||
with raises(NotImplementedError):
|
||||
schema_func(None, *range(args_qty))
|
||||
@ -31,7 +31,7 @@ def test_schema(schema_func_name, args_qty):
|
||||
('get_metadata', 1),
|
||||
))
|
||||
def test_query(query_func_name, args_qty):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
query_func = getattr(query, query_func_name)
|
||||
with raises(NotImplementedError):
|
||||
query_func(None, *range(args_qty))
|
||||
|
@ -15,7 +15,7 @@ def mock_module():
|
||||
|
||||
|
||||
def test_module_dispatch_registers(mock_module):
|
||||
from bigchaindb.backend.utils import module_dispatch_registrar
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
|
||||
@singledispatch
|
||||
def dispatcher(t):
|
||||
@ -31,7 +31,7 @@ def test_module_dispatch_registers(mock_module):
|
||||
|
||||
|
||||
def test_module_dispatch_dispatches(mock_module):
|
||||
from bigchaindb.backend.utils import module_dispatch_registrar
|
||||
from planetmint.backend.utils import module_dispatch_registrar
|
||||
|
||||
@singledispatch
|
||||
def dispatcher(t):
|
||||
@ -48,7 +48,7 @@ def test_module_dispatch_dispatches(mock_module):
|
||||
|
||||
|
||||
def test_module_dispatch_errors_on_missing_func(mock_module):
|
||||
from bigchaindb.backend.utils import (
|
||||
from planetmint.backend.utils import (
|
||||
module_dispatch_registrar,
|
||||
ModuleDispatchRegistrationError,
|
||||
)
|
||||
@ -61,7 +61,7 @@ def test_module_dispatch_errors_on_missing_func(mock_module):
|
||||
|
||||
|
||||
def test_module_dispatch_errors_on_non_dispatchable_func(mock_module):
|
||||
from bigchaindb.backend.utils import (
|
||||
from planetmint.backend.utils import (
|
||||
module_dispatch_registrar,
|
||||
ModuleDispatchRegistrationError,
|
||||
)
|
||||
|
@ -10,25 +10,25 @@ import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def mock_run_configure(monkeypatch):
|
||||
from bigchaindb.commands import bigchaindb
|
||||
monkeypatch.setattr(bigchaindb, 'run_configure', lambda *args, **kwargs: None)
|
||||
from planetmint.commands import planetmint
|
||||
monkeypatch.setattr(planetmint, 'run_configure', lambda *args, **kwargs: None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_write_config(monkeypatch):
|
||||
from bigchaindb import config_utils
|
||||
from planetmint import config_utils
|
||||
monkeypatch.setattr(config_utils, 'write_config', lambda *args: None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_db_init_with_existing_db(monkeypatch):
|
||||
from bigchaindb.commands import bigchaindb
|
||||
monkeypatch.setattr(bigchaindb, '_run_init', lambda: None)
|
||||
from planetmint.commands import planetmint
|
||||
monkeypatch.setattr(planetmint, '_run_init', lambda: None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_processes_start(monkeypatch):
|
||||
from bigchaindb import start
|
||||
from planetmint import start
|
||||
monkeypatch.setattr(start, 'start', lambda *args: None)
|
||||
|
||||
|
||||
|
@ -11,18 +11,18 @@ from argparse import Namespace
|
||||
|
||||
import pytest
|
||||
|
||||
from bigchaindb import ValidatorElection
|
||||
from bigchaindb.commands.bigchaindb import run_election_show
|
||||
from bigchaindb.elections.election import Election
|
||||
from bigchaindb.lib import Block
|
||||
from bigchaindb.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint import ValidatorElection
|
||||
from planetmint.commands.planetmint import run_election_show
|
||||
from planetmint.elections.election import Election
|
||||
from planetmint.lib import Block
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
|
||||
from tests.utils import generate_election, generate_validators
|
||||
|
||||
|
||||
def test_make_sure_we_dont_remove_any_command():
|
||||
# thanks to: http://stackoverflow.com/a/18161115/597097
|
||||
from bigchaindb.commands.bigchaindb import create_parser
|
||||
from planetmint.commands.planetmint import create_parser
|
||||
|
||||
parser = create_parser()
|
||||
|
||||
@ -43,7 +43,7 @@ def test_make_sure_we_dont_remove_any_command():
|
||||
|
||||
@patch('bigchaindb.commands.utils.start')
|
||||
def test_main_entrypoint(mock_start):
|
||||
from bigchaindb.commands.bigchaindb import main
|
||||
from planetmint.commands.planetmint import main
|
||||
main()
|
||||
|
||||
assert mock_start.called
|
||||
@ -54,7 +54,7 @@ def test_main_entrypoint(mock_start):
|
||||
@patch('bigchaindb.config_utils.autoconfigure')
|
||||
def test_bigchain_run_start(mock_setup_logging, mock_run_init,
|
||||
mock_autoconfigure, mock_processes_start):
|
||||
from bigchaindb.commands.bigchaindb import run_start
|
||||
from planetmint.commands.planetmint import run_start
|
||||
args = Namespace(config=None, yes=True,
|
||||
skip_initialize_database=False)
|
||||
run_start(args)
|
||||
@ -66,7 +66,7 @@ def test_bigchain_run_start(mock_setup_logging, mock_run_init,
|
||||
# See related issue: https://github.com/pytest-dev/pytest/issues/128
|
||||
@pytest.mark.usefixtures('ignore_local_config_file')
|
||||
def test_bigchain_show_config(capsys):
|
||||
from bigchaindb.commands.bigchaindb import run_show_config
|
||||
from planetmint.commands.planetmint import run_show_config
|
||||
|
||||
args = Namespace(config=None)
|
||||
_, _ = capsys.readouterr()
|
||||
@ -79,13 +79,13 @@ def test_bigchain_show_config(capsys):
|
||||
# the default comparison fails i.e. when config is imported at the beginning the
|
||||
# dict returned is different that what is expected after run_show_config
|
||||
# and run_show_config updates the bigchaindb.config
|
||||
from bigchaindb import config
|
||||
from planetmint import config
|
||||
del config['CONFIGURED']
|
||||
assert output_config == config
|
||||
|
||||
|
||||
def test__run_init(mocker):
|
||||
from bigchaindb.commands.bigchaindb import _run_init
|
||||
from planetmint.commands.planetmint import _run_init
|
||||
bigchain_mock = mocker.patch(
|
||||
'bigchaindb.commands.bigchaindb.bigchaindb.Planetmint')
|
||||
init_db_mock = mocker.patch(
|
||||
@ -101,7 +101,7 @@ def test__run_init(mocker):
|
||||
|
||||
@patch('bigchaindb.backend.schema.drop_database')
|
||||
def test_drop_db_when_assumed_yes(mock_db_drop):
|
||||
from bigchaindb.commands.bigchaindb import run_drop
|
||||
from planetmint.commands.planetmint import run_drop
|
||||
args = Namespace(config=None, yes=True)
|
||||
|
||||
run_drop(args)
|
||||
@ -110,7 +110,7 @@ def test_drop_db_when_assumed_yes(mock_db_drop):
|
||||
|
||||
@patch('bigchaindb.backend.schema.drop_database')
|
||||
def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch):
|
||||
from bigchaindb.commands.bigchaindb import run_drop
|
||||
from planetmint.commands.planetmint import run_drop
|
||||
args = Namespace(config=None, yes=False)
|
||||
monkeypatch.setattr(
|
||||
'bigchaindb.commands.bigchaindb.input_on_stderr', lambda x: 'y')
|
||||
@ -121,9 +121,9 @@ def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch):
|
||||
|
||||
@patch('bigchaindb.backend.schema.drop_database')
|
||||
def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys):
|
||||
from bigchaindb import config
|
||||
from bigchaindb.commands.bigchaindb import run_drop
|
||||
from bigchaindb.common.exceptions import DatabaseDoesNotExist
|
||||
from planetmint import config
|
||||
from planetmint.commands.planetmint import run_drop
|
||||
from planetmint.common.exceptions import DatabaseDoesNotExist
|
||||
args = Namespace(config=None, yes=True)
|
||||
mock_db_drop.side_effect = DatabaseDoesNotExist
|
||||
|
||||
@ -135,7 +135,7 @@ def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys):
|
||||
|
||||
@patch('bigchaindb.backend.schema.drop_database')
|
||||
def test_drop_db_does_not_drop_when_interactive_no(mock_db_drop, monkeypatch):
|
||||
from bigchaindb.commands.bigchaindb import run_drop
|
||||
from planetmint.commands.planetmint import run_drop
|
||||
args = Namespace(config=None, yes=False)
|
||||
monkeypatch.setattr(
|
||||
'bigchaindb.commands.bigchaindb.input_on_stderr', lambda x: 'n')
|
||||
@ -151,7 +151,7 @@ def test_run_configure_when_config_does_not_exist(monkeypatch,
|
||||
mock_write_config,
|
||||
mock_generate_key_pair,
|
||||
mock_bigchaindb_backup_config):
|
||||
from bigchaindb.commands.bigchaindb import run_configure
|
||||
from planetmint.commands.planetmint import run_configure
|
||||
monkeypatch.setattr('os.path.exists', lambda path: False)
|
||||
monkeypatch.setattr('builtins.input', lambda: '\n')
|
||||
args = Namespace(config=None, backend='localmongodb', yes=True)
|
||||
@ -168,7 +168,7 @@ def test_run_configure_when_config_does_exist(monkeypatch,
|
||||
def mock_write_config(newconfig):
|
||||
value['return'] = newconfig
|
||||
|
||||
from bigchaindb.commands.bigchaindb import run_configure
|
||||
from planetmint.commands.planetmint import run_configure
|
||||
monkeypatch.setattr('os.path.exists', lambda path: True)
|
||||
monkeypatch.setattr('builtins.input', lambda: '\n')
|
||||
monkeypatch.setattr(
|
||||
@ -184,8 +184,8 @@ def test_run_configure_when_config_does_exist(monkeypatch,
|
||||
'localmongodb',
|
||||
))
|
||||
def test_run_configure_with_backend(backend, monkeypatch, mock_write_config):
|
||||
import bigchaindb
|
||||
from bigchaindb.commands.bigchaindb import run_configure
|
||||
import planetmint
|
||||
from planetmint.commands.planetmint import run_configure
|
||||
|
||||
value = {}
|
||||
|
||||
@ -198,11 +198,11 @@ def test_run_configure_with_backend(backend, monkeypatch, mock_write_config):
|
||||
mock_write_config)
|
||||
|
||||
args = Namespace(config=None, backend=backend, yes=True)
|
||||
expected_config = bigchaindb.config
|
||||
expected_config = planetmint.config
|
||||
run_configure(args)
|
||||
|
||||
# update the expected config with the correct backend and keypair
|
||||
backend_conf = getattr(bigchaindb, '_database_' + backend)
|
||||
backend_conf = getattr(planetmint, '_database_' + backend)
|
||||
expected_config.update({'database': backend_conf,
|
||||
'keypair': value['return']['keypair']})
|
||||
|
||||
@ -211,7 +211,7 @@ def test_run_configure_with_backend(backend, monkeypatch, mock_write_config):
|
||||
|
||||
@patch('bigchaindb.commands.utils.start')
|
||||
def test_calling_main(start_mock, monkeypatch):
|
||||
from bigchaindb.commands.bigchaindb import main
|
||||
from planetmint.commands.planetmint import main
|
||||
|
||||
argparser_mock = Mock()
|
||||
parser = Mock()
|
||||
@ -247,7 +247,7 @@ def test_calling_main(start_mock, monkeypatch):
|
||||
def test_recover_db_on_start(mock_run_recover,
|
||||
mock_start,
|
||||
mocked_setup_logging):
|
||||
from bigchaindb.commands.bigchaindb import run_start
|
||||
from planetmint.commands.planetmint import run_start
|
||||
args = Namespace(config=None, yes=True,
|
||||
skip_initialize_database=False)
|
||||
run_start(args)
|
||||
@ -258,10 +258,10 @@ def test_recover_db_on_start(mock_run_recover,
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_run_recover(b, alice, bob):
|
||||
from bigchaindb.commands.bigchaindb import run_recover
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.lib import Block
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.commands.planetmint import run_recover
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.lib import Block
|
||||
from planetmint.backend import query
|
||||
|
||||
tx1 = Transaction.create([alice.public_key],
|
||||
[([alice.public_key], 1)],
|
||||
@ -308,7 +308,7 @@ class MockResponse():
|
||||
|
||||
@pytest.mark.abci
|
||||
def test_election_new_upsert_validator_with_tendermint(b, priv_validator_path, user_sk, validators):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_upsert_validator
|
||||
from planetmint.commands.planetmint import run_election_new_upsert_validator
|
||||
|
||||
new_args = Namespace(action='new',
|
||||
election_type='upsert-validator',
|
||||
@ -325,7 +325,7 @@ def test_election_new_upsert_validator_with_tendermint(b, priv_validator_path, u
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_new_upsert_validator_without_tendermint(caplog, b, priv_validator_path, user_sk):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_upsert_validator
|
||||
from planetmint.commands.planetmint import run_election_new_upsert_validator
|
||||
|
||||
def mock_write(tx, mode):
|
||||
b.store_bulk_transactions([tx])
|
||||
@ -350,7 +350,7 @@ def test_election_new_upsert_validator_without_tendermint(caplog, b, priv_valida
|
||||
|
||||
@pytest.mark.abci
|
||||
def test_election_new_chain_migration_with_tendermint(b, priv_validator_path, user_sk, validators):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_chain_migration
|
||||
from planetmint.commands.planetmint import run_election_new_chain_migration
|
||||
|
||||
new_args = Namespace(action='new',
|
||||
election_type='migration',
|
||||
@ -364,7 +364,7 @@ def test_election_new_chain_migration_with_tendermint(b, priv_validator_path, us
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validator_path, user_sk):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_chain_migration
|
||||
from planetmint.commands.planetmint import run_election_new_chain_migration
|
||||
|
||||
def mock_write(tx, mode):
|
||||
b.store_bulk_transactions([tx])
|
||||
@ -386,7 +386,7 @@ def test_election_new_chain_migration_without_tendermint(caplog, b, priv_validat
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_new_upsert_validator_invalid_election(caplog, b, priv_validator_path, user_sk):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_upsert_validator
|
||||
from planetmint.commands.planetmint import run_election_new_upsert_validator
|
||||
|
||||
args = Namespace(action='new',
|
||||
election_type='upsert-validator',
|
||||
@ -403,8 +403,8 @@ def test_election_new_upsert_validator_invalid_election(caplog, b, priv_validato
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_new_upsert_validator_invalid_power(caplog, b, priv_validator_path, user_sk):
|
||||
from bigchaindb.commands.bigchaindb import run_election_new_upsert_validator
|
||||
from bigchaindb.common.exceptions import InvalidPowerChange
|
||||
from planetmint.commands.planetmint import run_election_new_upsert_validator
|
||||
from planetmint.common.exceptions import InvalidPowerChange
|
||||
|
||||
def mock_write(tx, mode):
|
||||
b.store_bulk_transactions([tx])
|
||||
@ -427,7 +427,7 @@ def test_election_new_upsert_validator_invalid_power(caplog, b, priv_validator_p
|
||||
|
||||
@pytest.mark.abci
|
||||
def test_election_approve_with_tendermint(b, priv_validator_path, user_sk, validators):
|
||||
from bigchaindb.commands.bigchaindb import (run_election_new_upsert_validator,
|
||||
from planetmint.commands.planetmint import (run_election_new_upsert_validator,
|
||||
run_election_approve)
|
||||
|
||||
public_key = 'CJxdItf4lz2PwEf4SmYNAu/c/VpmX39JEgC5YpH7fxg='
|
||||
@ -453,7 +453,7 @@ def test_election_approve_with_tendermint(b, priv_validator_path, user_sk, valid
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_approve_without_tendermint(caplog, b, priv_validator_path, new_validator, node_key):
|
||||
from bigchaindb.commands.bigchaindb import run_election_approve
|
||||
from planetmint.commands.planetmint import run_election_approve
|
||||
from argparse import Namespace
|
||||
|
||||
b, election_id = call_election(b, new_validator, node_key)
|
||||
@ -473,7 +473,7 @@ def test_election_approve_without_tendermint(caplog, b, priv_validator_path, new
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_approve_failure(caplog, b, priv_validator_path, new_validator, node_key):
|
||||
from bigchaindb.commands.bigchaindb import run_election_approve
|
||||
from planetmint.commands.planetmint import run_election_approve
|
||||
from argparse import Namespace
|
||||
|
||||
b, election_id = call_election(b, new_validator, node_key)
|
||||
@ -497,7 +497,7 @@ def test_election_approve_failure(caplog, b, priv_validator_path, new_validator,
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_election_approve_called_with_bad_key(caplog, b, bad_validator_path, new_validator, node_key):
|
||||
from bigchaindb.commands.bigchaindb import run_election_approve
|
||||
from planetmint.commands.planetmint import run_election_approve
|
||||
from argparse import Namespace
|
||||
|
||||
b, election_id = call_election(b, new_validator, node_key)
|
||||
@ -595,13 +595,13 @@ validators=[{''.join([f"""
|
||||
|
||||
|
||||
def test_bigchain_tendermint_version(capsys):
|
||||
from bigchaindb.commands.bigchaindb import run_tendermint_version
|
||||
from planetmint.commands.planetmint import run_tendermint_version
|
||||
|
||||
args = Namespace(config=None)
|
||||
_, _ = capsys.readouterr()
|
||||
run_tendermint_version(args)
|
||||
output_config = json.loads(capsys.readouterr()[0])
|
||||
from bigchaindb.version import __tm_supported_versions__
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
assert len(output_config["tendermint"]) == len(__tm_supported_versions__)
|
||||
assert sorted(output_config["tendermint"]) == sorted(__tm_supported_versions__)
|
||||
|
||||
|
@ -14,12 +14,12 @@ from unittest.mock import patch
|
||||
|
||||
@pytest.fixture
|
||||
def reset_bigchaindb_config(monkeypatch):
|
||||
import bigchaindb
|
||||
monkeypatch.setattr('bigchaindb.config', bigchaindb._config)
|
||||
import planetmint
|
||||
monkeypatch.setattr('bigchaindb.config', planetmint._config)
|
||||
|
||||
|
||||
def test_input_on_stderr():
|
||||
from bigchaindb.commands.utils import input_on_stderr, _convert
|
||||
from planetmint.commands.utils import input_on_stderr, _convert
|
||||
|
||||
with patch('builtins.input', return_value='I love cats'):
|
||||
assert input_on_stderr() == 'I love cats'
|
||||
@ -47,8 +47,8 @@ def test_input_on_stderr():
|
||||
|
||||
@pytest.mark.usefixtures('ignore_local_config_file', 'reset_bigchaindb_config')
|
||||
def test_configure_bigchaindb_configures_bigchaindb():
|
||||
from bigchaindb.commands.utils import configure_bigchaindb
|
||||
from bigchaindb.config_utils import is_configured
|
||||
from planetmint.commands.utils import configure_bigchaindb
|
||||
from planetmint.config_utils import is_configured
|
||||
assert not is_configured()
|
||||
|
||||
@configure_bigchaindb
|
||||
@ -77,7 +77,7 @@ def test_configure_bigchaindb_logging(log_level):
|
||||
# either engineer this somehow to leave the test env in the same state as it finds it, or make an assessment
|
||||
# whether or not we even need this test, and potentially just remove it.
|
||||
|
||||
from bigchaindb.commands.utils import configure_bigchaindb
|
||||
from planetmint.commands.utils import configure_bigchaindb
|
||||
|
||||
@configure_bigchaindb
|
||||
def test_configure_logger(args):
|
||||
@ -85,14 +85,14 @@ def test_configure_bigchaindb_logging(log_level):
|
||||
|
||||
args = Namespace(config=None, log_level=log_level)
|
||||
test_configure_logger(args)
|
||||
from bigchaindb import config
|
||||
from planetmint import config
|
||||
assert config['log']['level_console'] == log_level
|
||||
assert config['log']['level_logfile'] == log_level
|
||||
|
||||
|
||||
def test_start_raises_if_command_not_implemented():
|
||||
from bigchaindb.commands import utils
|
||||
from bigchaindb.commands.bigchaindb import create_parser
|
||||
from planetmint.commands import utils
|
||||
from planetmint.commands.planetmint import create_parser
|
||||
|
||||
parser = create_parser()
|
||||
|
||||
@ -103,8 +103,8 @@ def test_start_raises_if_command_not_implemented():
|
||||
|
||||
|
||||
def test_start_raises_if_no_arguments_given():
|
||||
from bigchaindb.commands import utils
|
||||
from bigchaindb.commands.bigchaindb import create_parser
|
||||
from planetmint.commands import utils
|
||||
from planetmint.commands.planetmint import create_parser
|
||||
|
||||
parser = create_parser()
|
||||
|
||||
@ -114,7 +114,7 @@ def test_start_raises_if_no_arguments_given():
|
||||
|
||||
@patch('multiprocessing.cpu_count', return_value=42)
|
||||
def test_start_sets_multiprocess_var_based_on_cli_args(mock_cpu_count):
|
||||
from bigchaindb.commands import utils
|
||||
from planetmint.commands import utils
|
||||
|
||||
def run_mp_arg_test(args):
|
||||
return args
|
||||
|
@ -100,31 +100,31 @@ def user2_Ed25519(user2_pub):
|
||||
|
||||
@pytest.fixture
|
||||
def user_input(user_Ed25519, user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
return Input(user_Ed25519, [user_pub])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_user2_threshold_output(user_user2_threshold, user_pub, user2_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
return Output(user_user2_threshold, [user_pub, user2_pub])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_user2_threshold_input(user_user2_threshold, user_pub, user2_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
return Input(user_user2_threshold, [user_pub, user2_pub])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_output(user_Ed25519, user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
return Output(user_Ed25519, [user_pub])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user2_output(user2_Ed25519, user2_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
return Output(user2_Ed25519, [user2_pub])
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ def data():
|
||||
|
||||
@pytest.fixture
|
||||
def utx(user_input, user_output):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
return Transaction(Transaction.CREATE, {'data': None}, [user_input],
|
||||
[user_output])
|
||||
|
||||
@ -152,7 +152,7 @@ def tx(utx, user_priv):
|
||||
|
||||
@pytest.fixture
|
||||
def transfer_utx(user_output, user2_output, utx):
|
||||
from bigchaindb.common.transaction import (Input, TransactionLink,
|
||||
from planetmint.common.transaction import (Input, TransactionLink,
|
||||
Transaction)
|
||||
user_output = user_output.to_dict()
|
||||
input = Input(utx.outputs[0].fulfillment,
|
||||
|
@ -6,9 +6,9 @@
|
||||
import pytest
|
||||
from copy import deepcopy
|
||||
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from bigchaindb.common.memoize import to_dict, from_dict
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
from planetmint.common.memoize import to_dict, from_dict
|
||||
|
||||
|
||||
pytestmark = pytest.mark.bdb
|
||||
|
@ -13,8 +13,8 @@ from hypothesis import given
|
||||
from hypothesis.strategies import from_regex as regex
|
||||
from pytest import raises
|
||||
|
||||
from bigchaindb.common.exceptions import SchemaValidationError
|
||||
from bigchaindb.common.schema import (
|
||||
from planetmint.common.exceptions import SchemaValidationError
|
||||
from planetmint.common.schema import (
|
||||
TX_SCHEMA_COMMON,
|
||||
validate_transaction_schema,
|
||||
)
|
||||
|
@ -21,7 +21,7 @@ pytestmark = mark.bdb
|
||||
|
||||
|
||||
def test_input_serialization(ffill_uri, user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
from cryptoconditions import Fulfillment
|
||||
|
||||
expected = {
|
||||
@ -34,7 +34,7 @@ def test_input_serialization(ffill_uri, user_pub):
|
||||
|
||||
|
||||
def test_input_deserialization_with_uri(ffill_uri, user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
from cryptoconditions import Fulfillment
|
||||
|
||||
expected = Input(Fulfillment.from_uri(ffill_uri), [user_pub])
|
||||
@ -50,7 +50,7 @@ def test_input_deserialization_with_uri(ffill_uri, user_pub):
|
||||
|
||||
@mark.skip(reason='None is tolerated because it is None before fulfilling.')
|
||||
def test_input_deserialization_with_invalid_input(user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
|
||||
ffill = {
|
||||
'owners_before': [user_pub],
|
||||
@ -62,8 +62,8 @@ def test_input_deserialization_with_invalid_input(user_pub):
|
||||
|
||||
|
||||
def test_input_deserialization_with_invalid_fulfillment_uri(user_pub):
|
||||
from bigchaindb.common.exceptions import InvalidSignature
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.exceptions import InvalidSignature
|
||||
from planetmint.common.transaction import Input
|
||||
|
||||
ffill = {
|
||||
'owners_before': [user_pub],
|
||||
@ -75,7 +75,7 @@ def test_input_deserialization_with_invalid_fulfillment_uri(user_pub):
|
||||
|
||||
|
||||
def test_input_deserialization_with_unsigned_fulfillment(ffill_uri, user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
from cryptoconditions import Fulfillment
|
||||
|
||||
expected = Input(Fulfillment.from_uri(ffill_uri), [user_pub])
|
||||
@ -90,7 +90,7 @@ def test_input_deserialization_with_unsigned_fulfillment(ffill_uri, user_pub):
|
||||
|
||||
|
||||
def test_output_serialization(user_Ed25519, user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
|
||||
expected = {
|
||||
'condition': {
|
||||
@ -110,7 +110,7 @@ def test_output_serialization(user_Ed25519, user_pub):
|
||||
|
||||
|
||||
def test_output_deserialization(user_Ed25519, user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
|
||||
expected = Output(user_Ed25519, [user_pub], 1)
|
||||
cond = {
|
||||
@ -130,7 +130,7 @@ def test_output_deserialization(user_Ed25519, user_pub):
|
||||
|
||||
|
||||
def test_output_hashlock_serialization():
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import PreimageSha256
|
||||
|
||||
secret = b'wow much secret'
|
||||
@ -149,7 +149,7 @@ def test_output_hashlock_serialization():
|
||||
|
||||
|
||||
def test_output_hashlock_deserialization():
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import PreimageSha256
|
||||
|
||||
secret = b'wow much secret'
|
||||
@ -169,8 +169,8 @@ def test_output_hashlock_deserialization():
|
||||
|
||||
|
||||
def test_invalid_output_initialization(cond_uri, user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from bigchaindb.common.exceptions import AmountError
|
||||
from planetmint.common.transaction import Output
|
||||
from planetmint.common.exceptions import AmountError
|
||||
|
||||
with raises(TypeError):
|
||||
Output(cond_uri, user_pub)
|
||||
@ -181,7 +181,7 @@ def test_invalid_output_initialization(cond_uri, user_pub):
|
||||
|
||||
|
||||
def test_generate_output_split_half_recursive(user_pub, user2_pub, user3_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256, ThresholdSha256
|
||||
|
||||
expected_simple1 = Ed25519Sha256(public_key=b58decode(user_pub))
|
||||
@ -201,7 +201,7 @@ def test_generate_output_split_half_recursive(user_pub, user2_pub, user3_pub):
|
||||
|
||||
def test_generate_outputs_split_half_single_owner(user_pub,
|
||||
user2_pub, user3_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256, ThresholdSha256
|
||||
|
||||
expected_simple1 = Ed25519Sha256(public_key=b58decode(user_pub))
|
||||
@ -220,7 +220,7 @@ def test_generate_outputs_split_half_single_owner(user_pub,
|
||||
|
||||
|
||||
def test_generate_outputs_flat_ownage(user_pub, user2_pub, user3_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256, ThresholdSha256
|
||||
|
||||
expected_simple1 = Ed25519Sha256(public_key=b58decode(user_pub))
|
||||
@ -237,7 +237,7 @@ def test_generate_outputs_flat_ownage(user_pub, user2_pub, user3_pub):
|
||||
|
||||
|
||||
def test_generate_output_single_owner(user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
|
||||
expected = Ed25519Sha256(public_key=b58decode(user_pub))
|
||||
@ -247,7 +247,7 @@ def test_generate_output_single_owner(user_pub):
|
||||
|
||||
|
||||
def test_generate_output_single_owner_with_output(user_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
|
||||
expected = Ed25519Sha256(public_key=b58decode(user_pub))
|
||||
@ -257,8 +257,8 @@ def test_generate_output_single_owner_with_output(user_pub):
|
||||
|
||||
|
||||
def test_generate_output_invalid_parameters(user_pub, user2_pub, user3_pub):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from bigchaindb.common.exceptions import AmountError
|
||||
from planetmint.common.transaction import Output
|
||||
from planetmint.common.exceptions import AmountError
|
||||
|
||||
with raises(ValueError):
|
||||
Output.generate([], 1)
|
||||
@ -273,7 +273,7 @@ def test_generate_output_invalid_parameters(user_pub, user2_pub, user3_pub):
|
||||
|
||||
|
||||
def test_invalid_transaction_initialization(asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
with raises(ValueError):
|
||||
Transaction(operation='invalid operation', asset=asset_definition)
|
||||
@ -305,7 +305,7 @@ def test_invalid_transaction_initialization(asset_definition):
|
||||
|
||||
|
||||
def test_create_default_asset_on_tx_initialization(asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
expected = {'data': None}
|
||||
tx = Transaction(Transaction.CREATE, asset=expected)
|
||||
@ -315,7 +315,7 @@ def test_create_default_asset_on_tx_initialization(asset_definition):
|
||||
|
||||
|
||||
def test_transaction_serialization(user_input, user_output, data):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
expected = {
|
||||
'id': None,
|
||||
@ -339,14 +339,14 @@ def test_transaction_serialization(user_input, user_output, data):
|
||||
|
||||
|
||||
def test_transaction_deserialization(tri_state_transaction):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
tx = Transaction.from_dict(tri_state_transaction)
|
||||
validate_transaction_model(tx)
|
||||
|
||||
|
||||
def test_invalid_input_initialization(user_input, user_pub):
|
||||
from bigchaindb.common.transaction import Input
|
||||
from planetmint.common.transaction import Input
|
||||
|
||||
with raises(TypeError):
|
||||
Input(user_input, user_pub)
|
||||
@ -355,7 +355,7 @@ def test_invalid_input_initialization(user_input, user_pub):
|
||||
|
||||
|
||||
def test_transaction_link_serialization():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
tx_id = 'a transaction id'
|
||||
expected = {
|
||||
@ -368,7 +368,7 @@ def test_transaction_link_serialization():
|
||||
|
||||
|
||||
def test_transaction_link_serialization_with_empty_payload():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
expected = None
|
||||
tx_link = TransactionLink()
|
||||
@ -377,7 +377,7 @@ def test_transaction_link_serialization_with_empty_payload():
|
||||
|
||||
|
||||
def test_transaction_link_deserialization():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
tx_id = 'a transaction id'
|
||||
expected = TransactionLink(tx_id, 0)
|
||||
@ -391,7 +391,7 @@ def test_transaction_link_deserialization():
|
||||
|
||||
|
||||
def test_transaction_link_deserialization_with_empty_payload():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
expected = TransactionLink()
|
||||
tx_link = TransactionLink.from_dict(None)
|
||||
@ -400,7 +400,7 @@ def test_transaction_link_deserialization_with_empty_payload():
|
||||
|
||||
|
||||
def test_transaction_link_empty_to_uri():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
expected = None
|
||||
tx_link = TransactionLink().to_uri()
|
||||
@ -409,7 +409,7 @@ def test_transaction_link_empty_to_uri():
|
||||
|
||||
|
||||
def test_transaction_link_to_uri():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
expected = 'path/transactions/abc/outputs/0'
|
||||
tx_link = TransactionLink('abc', 0).to_uri('path')
|
||||
@ -418,7 +418,7 @@ def test_transaction_link_to_uri():
|
||||
|
||||
|
||||
def test_cast_transaction_link_to_boolean():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
assert bool(TransactionLink()) is False
|
||||
assert bool(TransactionLink('a', None)) is False
|
||||
@ -428,7 +428,7 @@ def test_cast_transaction_link_to_boolean():
|
||||
|
||||
|
||||
def test_transaction_link_eq():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
assert TransactionLink(1, 2) == TransactionLink(1, 2)
|
||||
assert TransactionLink(2, 2) != TransactionLink(1, 2)
|
||||
@ -437,7 +437,7 @@ def test_transaction_link_eq():
|
||||
|
||||
|
||||
def test_add_input_to_tx(user_input, asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction(Transaction.CREATE, asset_definition, [], [])
|
||||
@ -449,7 +449,7 @@ def test_add_input_to_tx(user_input, asset_definition):
|
||||
|
||||
|
||||
def test_add_input_to_tx_with_invalid_parameters(asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx = Transaction(Transaction.CREATE, asset_definition)
|
||||
|
||||
with raises(TypeError):
|
||||
@ -457,7 +457,7 @@ def test_add_input_to_tx_with_invalid_parameters(asset_definition):
|
||||
|
||||
|
||||
def test_add_output_to_tx(user_output, user_input, asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction(Transaction.CREATE, asset_definition, [user_input])
|
||||
@ -469,7 +469,7 @@ def test_add_output_to_tx(user_output, user_input, asset_definition):
|
||||
|
||||
|
||||
def test_add_output_to_tx_with_invalid_parameters(asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx = Transaction(Transaction.CREATE, asset_definition, [], [])
|
||||
|
||||
with raises(TypeError):
|
||||
@ -485,7 +485,7 @@ def test_sign_with_invalid_parameters(utx, user_priv):
|
||||
|
||||
def test_validate_tx_simple_create_signature(user_input, user_output, user_priv,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction(Transaction.CREATE, asset_definition, [user_input], [user_output])
|
||||
@ -507,7 +507,7 @@ def test_validate_tx_simple_create_signature(user_input, user_output, user_priv,
|
||||
|
||||
def test_invoke_simple_signature_fulfillment_with_invalid_params(utx,
|
||||
user_input):
|
||||
from bigchaindb.common.exceptions import KeypairMismatchException
|
||||
from planetmint.common.exceptions import KeypairMismatchException
|
||||
|
||||
with raises(KeypairMismatchException):
|
||||
invalid_key_pair = {'wrong_pub_key': 'wrong_priv_key'}
|
||||
@ -518,7 +518,7 @@ def test_invoke_simple_signature_fulfillment_with_invalid_params(utx,
|
||||
|
||||
def test_sign_threshold_with_invalid_params(utx, user_user2_threshold_input,
|
||||
user3_pub, user3_priv):
|
||||
from bigchaindb.common.exceptions import KeypairMismatchException
|
||||
from planetmint.common.exceptions import KeypairMismatchException
|
||||
|
||||
with raises(KeypairMismatchException):
|
||||
utx._sign_threshold_signature_fulfillment(user_user2_threshold_input,
|
||||
@ -532,7 +532,7 @@ def test_sign_threshold_with_invalid_params(utx, user_user2_threshold_input,
|
||||
|
||||
|
||||
def test_validate_input_with_invalid_parameters(utx):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
input_conditions = [out.fulfillment.condition_uri for out in utx.outputs]
|
||||
tx_dict = utx.to_dict()
|
||||
@ -548,7 +548,7 @@ def test_validate_tx_threshold_create_signature(user_user2_threshold_input,
|
||||
user_priv,
|
||||
user2_priv,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction(Transaction.CREATE, asset_definition,
|
||||
@ -576,7 +576,7 @@ def test_validate_tx_threshold_create_signature(user_user2_threshold_input,
|
||||
def test_validate_tx_threshold_duplicated_pk(user_pub, user_priv,
|
||||
asset_definition):
|
||||
from cryptoconditions import Ed25519Sha256, ThresholdSha256
|
||||
from bigchaindb.common.transaction import Input, Output, Transaction
|
||||
from planetmint.common.transaction import Input, Output, Transaction
|
||||
|
||||
threshold = ThresholdSha256(threshold=2)
|
||||
threshold.add_subfulfillment(
|
||||
@ -621,7 +621,7 @@ def test_multiple_input_validation_of_transfer_tx(user_input, user_output,
|
||||
user2_priv, user3_pub,
|
||||
user3_priv,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import (Transaction, TransactionLink,
|
||||
from planetmint.common.transaction import (Transaction, TransactionLink,
|
||||
Input, Output)
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
from .utils import validate_transaction_model
|
||||
@ -647,7 +647,7 @@ def test_multiple_input_validation_of_transfer_tx(user_input, user_output,
|
||||
|
||||
def test_validate_inputs_of_transfer_tx_with_invalid_params(
|
||||
transfer_tx, cond_uri, utx, user2_pub, user_priv, ffill_uri):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from planetmint.common.transaction import Output
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
|
||||
invalid_out = Output(Ed25519Sha256.from_uri(ffill_uri), ['invalid'])
|
||||
@ -668,7 +668,7 @@ def test_validate_inputs_of_transfer_tx_with_invalid_params(
|
||||
|
||||
|
||||
def test_create_create_transaction_single_io(user_output, user_pub, data):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
expected = {
|
||||
@ -703,7 +703,7 @@ def test_create_create_transaction_single_io(user_output, user_pub, data):
|
||||
|
||||
def test_validate_single_io_create_transaction(user_pub, user_priv, data,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
tx = Transaction.create([user_pub], [([user_pub], 1)], metadata=data)
|
||||
tx = tx.sign([user_priv])
|
||||
@ -712,7 +712,7 @@ def test_validate_single_io_create_transaction(user_pub, user_priv, data,
|
||||
|
||||
def test_create_create_transaction_multiple_io(user_output, user2_output, user_pub,
|
||||
user2_pub, asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction, Input
|
||||
from planetmint.common.transaction import Transaction, Input
|
||||
|
||||
# a fulfillment for a create transaction with multiple `owners_before`
|
||||
# is a fulfillment for an implicit threshold condition with
|
||||
@ -739,7 +739,7 @@ def test_create_create_transaction_multiple_io(user_output, user2_output, user_p
|
||||
def test_validate_multiple_io_create_transaction(user_pub, user_priv,
|
||||
user2_pub, user2_priv,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction.create([user_pub, user2_pub],
|
||||
@ -754,7 +754,7 @@ def test_validate_multiple_io_create_transaction(user_pub, user_priv,
|
||||
def test_create_create_transaction_threshold(user_pub, user2_pub, user3_pub,
|
||||
user_user2_threshold_output,
|
||||
user_user2_threshold_input, data):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
expected = {
|
||||
'outputs': [user_user2_threshold_output.to_dict()],
|
||||
@ -785,7 +785,7 @@ def test_create_create_transaction_threshold(user_pub, user2_pub, user3_pub,
|
||||
|
||||
def test_validate_threshold_create_transaction(user_pub, user_priv, user2_pub,
|
||||
data, asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
tx = Transaction.create([user_pub], [([user_pub, user2_pub], 1)],
|
||||
@ -797,7 +797,7 @@ def test_validate_threshold_create_transaction(user_pub, user_priv, user2_pub,
|
||||
|
||||
|
||||
def test_create_create_transaction_with_invalid_parameters(user_pub):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
with raises(TypeError):
|
||||
Transaction.create('not a list')
|
||||
@ -832,7 +832,7 @@ def test_outputs_to_inputs(tx):
|
||||
|
||||
def test_create_transfer_transaction_single_io(tx, user_pub, user2_pub,
|
||||
user2_output, user_priv):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
from .utils import validate_transaction_model
|
||||
|
||||
expected = {
|
||||
@ -887,7 +887,7 @@ def test_create_transfer_transaction_multiple_io(user_pub, user_priv,
|
||||
user2_pub, user2_priv,
|
||||
user3_pub, user2_output,
|
||||
asset_definition):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
tx = Transaction.create([user_pub], [([user_pub], 1), ([user2_pub], 1)],
|
||||
metadata={'message': 'hello'})
|
||||
@ -941,7 +941,7 @@ def test_create_transfer_transaction_multiple_io(user_pub, user_priv,
|
||||
|
||||
|
||||
def test_create_transfer_with_invalid_parameters(tx, user_pub):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
|
||||
with raises(TypeError):
|
||||
Transaction.transfer({}, [], tx.id)
|
||||
@ -964,7 +964,7 @@ def test_create_transfer_with_invalid_parameters(tx, user_pub):
|
||||
|
||||
|
||||
def test_cant_add_empty_output():
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx = Transaction(Transaction.CREATE, None)
|
||||
|
||||
with raises(TypeError):
|
||||
@ -972,7 +972,7 @@ def test_cant_add_empty_output():
|
||||
|
||||
|
||||
def test_cant_add_empty_input():
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx = Transaction(Transaction.CREATE, None)
|
||||
|
||||
with raises(TypeError):
|
||||
@ -980,7 +980,7 @@ def test_cant_add_empty_input():
|
||||
|
||||
|
||||
def test_unfulfilled_transaction_serialized(unfulfilled_transaction):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx_obj = Transaction.from_dict(unfulfilled_transaction)
|
||||
expected = json.dumps(unfulfilled_transaction, sort_keys=True,
|
||||
separators=(',', ':'), ensure_ascii=True)
|
||||
@ -988,7 +988,7 @@ def test_unfulfilled_transaction_serialized(unfulfilled_transaction):
|
||||
|
||||
|
||||
def test_fulfilled_transaction_serialized(fulfilled_transaction):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx_obj = Transaction.from_dict(fulfilled_transaction)
|
||||
expected = json.dumps(fulfilled_transaction, sort_keys=True,
|
||||
separators=(',', ':'), ensure_ascii=True)
|
||||
@ -996,7 +996,7 @@ def test_fulfilled_transaction_serialized(fulfilled_transaction):
|
||||
|
||||
|
||||
def test_transaction_hash(fulfilled_transaction):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx_obj = Transaction.from_dict(fulfilled_transaction)
|
||||
assert tx_obj._id is None
|
||||
assert tx_obj.id is None
|
||||
@ -1009,8 +1009,8 @@ def test_transaction_hash(fulfilled_transaction):
|
||||
|
||||
|
||||
def test_output_from_dict_invalid_amount(user_output):
|
||||
from bigchaindb.common.transaction import Output
|
||||
from bigchaindb.common.exceptions import AmountError
|
||||
from planetmint.common.transaction import Output
|
||||
from planetmint.common.exceptions import AmountError
|
||||
|
||||
out = user_output.to_dict()
|
||||
out['amount'] = 'a'
|
||||
@ -1019,7 +1019,7 @@ def test_output_from_dict_invalid_amount(user_output):
|
||||
|
||||
|
||||
def test_unspent_outputs_property(merlin, alice, bob, carol):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from planetmint.common.transaction import Transaction
|
||||
tx = Transaction.create(
|
||||
[merlin.public_key],
|
||||
[([alice.public_key], 1),
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
|
||||
def validate_transaction_model(tx):
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.schema import validate_transaction_schema
|
||||
from planetmint.common.transaction import Transaction
|
||||
from planetmint.common.schema import validate_transaction_schema
|
||||
|
||||
tx_dict = tx.to_dict()
|
||||
# Check that a transaction is valid by re-serializing it
|
||||
|
@ -21,15 +21,15 @@ from logging.config import dictConfig
|
||||
import pytest
|
||||
from pymongo import MongoClient
|
||||
|
||||
from bigchaindb import ValidatorElection
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from bigchaindb.tendermint_utils import key_from_base64
|
||||
from bigchaindb.backend import schema, query
|
||||
from bigchaindb.common.crypto import (key_pair_from_ed25519_key,
|
||||
from planetmint import ValidatorElection
|
||||
from planetmint.common import crypto
|
||||
from planetmint.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from planetmint.tendermint_utils import key_from_base64
|
||||
from planetmint.backend import schema, query
|
||||
from planetmint.common.crypto import (key_pair_from_ed25519_key,
|
||||
public_key_from_ed25519_key)
|
||||
from bigchaindb.common.exceptions import DatabaseDoesNotExist
|
||||
from bigchaindb.lib import Block
|
||||
from planetmint.common.exceptions import DatabaseDoesNotExist
|
||||
from planetmint.lib import Block
|
||||
from tests.utils import gen_vote
|
||||
|
||||
TEST_DB_NAME = 'bigchain_test'
|
||||
@ -42,7 +42,7 @@ USER_PUBLIC_KEY = 'JEAkEJqLbbgDRAtMm8YAjGp759Aq2qTn9eaEHUj2XePE'
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
from bigchaindb.backend.connection import BACKENDS
|
||||
from planetmint.backend.connection import BACKENDS
|
||||
|
||||
backends = ', '.join(BACKENDS.keys())
|
||||
parser.addoption(
|
||||
@ -80,7 +80,7 @@ def _bdb_marker(request):
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _restore_config(_configure_bigchaindb):
|
||||
from bigchaindb import config, config_utils
|
||||
from planetmint import config, config_utils
|
||||
config_before_test = copy.deepcopy(config)
|
||||
yield
|
||||
config_utils.set_config(config_before_test)
|
||||
@ -88,8 +88,8 @@ def _restore_config(_configure_bigchaindb):
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def _configure_bigchaindb(request):
|
||||
import bigchaindb
|
||||
from bigchaindb import config_utils
|
||||
import planetmint
|
||||
from planetmint import config_utils
|
||||
test_db_name = TEST_DB_NAME
|
||||
# Put a suffix like _gw0, _gw1 etc on xdist processes
|
||||
xdist_suffix = getattr(request.config, 'slaveinput', {}).get('slaveid')
|
||||
@ -99,7 +99,7 @@ def _configure_bigchaindb(request):
|
||||
backend = request.config.getoption('--database-backend')
|
||||
|
||||
config = {
|
||||
'database': bigchaindb._database_map[backend],
|
||||
'database': planetmint._database_map[backend],
|
||||
'tendermint': {
|
||||
'host': 'localhost',
|
||||
'port': 26657,
|
||||
@ -112,8 +112,8 @@ def _configure_bigchaindb(request):
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def _setup_database(_configure_bigchaindb):
|
||||
from bigchaindb import config
|
||||
from bigchaindb.backend import connect
|
||||
from planetmint import config
|
||||
from planetmint.backend import connect
|
||||
print('Initializing test db')
|
||||
dbname = config['database']['name']
|
||||
conn = connect()
|
||||
@ -133,11 +133,11 @@ def _setup_database(_configure_bigchaindb):
|
||||
|
||||
@pytest.fixture
|
||||
def _bdb(_setup_database, _configure_bigchaindb):
|
||||
from bigchaindb import config
|
||||
from bigchaindb.backend import connect
|
||||
from planetmint import config
|
||||
from planetmint.backend import connect
|
||||
from .utils import flush_db
|
||||
from bigchaindb.common.memoize import to_dict, from_dict
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.memoize import to_dict, from_dict
|
||||
from planetmint.models import Transaction
|
||||
conn = connect()
|
||||
yield
|
||||
dbname = config['database']['name']
|
||||
@ -192,13 +192,13 @@ def user2_pk():
|
||||
|
||||
@pytest.fixture
|
||||
def alice():
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
return generate_key_pair()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def bob():
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
return generate_key_pair()
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ def bob_pubkey(carol):
|
||||
|
||||
@pytest.fixture
|
||||
def carol():
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
return generate_key_pair()
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ def carol_pubkey(carol):
|
||||
|
||||
@pytest.fixture
|
||||
def merlin():
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
return generate_key_pair()
|
||||
|
||||
|
||||
@ -242,7 +242,7 @@ def a():
|
||||
|
||||
@pytest.fixture
|
||||
def b():
|
||||
from bigchaindb import BigchainDB
|
||||
from planetmint import BigchainDB
|
||||
return BigchainDB)
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ def mock_get_validators(network_validators):
|
||||
|
||||
@pytest.fixture
|
||||
def create_tx(alice, user_pk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
name = f'I am created by the create_tx fixture. My random identifier is {random.random()}.'
|
||||
return Transaction.create([alice.public_key], [([user_pk], 1)], asset={'name': name})
|
||||
|
||||
@ -287,7 +287,7 @@ def posted_create_tx(b, signed_create_tx):
|
||||
|
||||
@pytest.fixture
|
||||
def signed_transfer_tx(signed_create_tx, user_pk, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
inputs = signed_create_tx.to_inputs()
|
||||
tx = Transaction.transfer(inputs, [([user_pk], 1)], asset_id=signed_create_tx.id)
|
||||
return tx.sign([user_sk])
|
||||
@ -295,7 +295,7 @@ def signed_transfer_tx(signed_create_tx, user_pk, user_sk):
|
||||
|
||||
@pytest.fixture
|
||||
def double_spend_tx(signed_create_tx, carol_pubkey, user_sk):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
inputs = signed_create_tx.to_inputs()
|
||||
tx = Transaction.transfer(
|
||||
inputs, [([carol_pubkey], 1)], asset_id=signed_create_tx.id)
|
||||
@ -309,7 +309,7 @@ def _get_height(b):
|
||||
|
||||
@pytest.fixture
|
||||
def inputs(user_pk, b, alice):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
# create blocks with transactions for `USER` to spend
|
||||
for height in range(1, 4):
|
||||
transactions = [
|
||||
@ -328,7 +328,7 @@ def inputs(user_pk, b, alice):
|
||||
|
||||
@pytest.fixture
|
||||
def dummy_db(request):
|
||||
from bigchaindb.backend import connect
|
||||
from planetmint.backend import connect
|
||||
|
||||
conn = connect()
|
||||
dbname = request.fixturename
|
||||
@ -352,7 +352,7 @@ def _drop_db(conn, dbname):
|
||||
|
||||
@pytest.fixture
|
||||
def db_config():
|
||||
from bigchaindb import config
|
||||
from planetmint import config
|
||||
return config['database']
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ def db_name(db_config):
|
||||
|
||||
@pytest.fixture
|
||||
def db_conn():
|
||||
from bigchaindb.backend import connect
|
||||
from planetmint.backend import connect
|
||||
return connect()
|
||||
|
||||
|
||||
@ -443,8 +443,8 @@ def event_loop():
|
||||
def abci_server():
|
||||
from abci.server import ABCIServer
|
||||
from abci import types_v0_31_5
|
||||
from bigchaindb.core import App
|
||||
from bigchaindb.utils import Process
|
||||
from planetmint.core import App
|
||||
from planetmint.utils import Process
|
||||
|
||||
app = ABCIServer(app=App(types_v0_31_5))
|
||||
abci_proxy = Process(name='ABCI', target=app.run)
|
||||
@ -454,7 +454,7 @@ def abci_server():
|
||||
|
||||
@pytest.fixture
|
||||
def wsserver_config():
|
||||
from bigchaindb import config
|
||||
from planetmint import config
|
||||
return config['wsserver']
|
||||
|
||||
|
||||
@ -645,7 +645,7 @@ def bad_validator_path(node_keys):
|
||||
|
||||
@pytest.fixture
|
||||
def validators(b, node_keys):
|
||||
from bigchaindb.backend import query
|
||||
from planetmint.backend import query
|
||||
import time
|
||||
|
||||
def timestamp(): # we need this to force unique election_ids for setup and teardown of fixtures
|
||||
|
@ -14,9 +14,9 @@ pytestmark = pytest.mark.bdb
|
||||
class TestBigchainApi(object):
|
||||
|
||||
def test_get_spent_with_double_spend_detected(self, b, alice):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import DoubleSpend
|
||||
from bigchaindb.exceptions import CriticalDoubleSpend
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.exceptions import DoubleSpend
|
||||
from planetmint.exceptions import CriticalDoubleSpend
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([alice.public_key], 1)])
|
||||
tx = tx.sign([alice.private_key])
|
||||
@ -44,8 +44,8 @@ class TestBigchainApi(object):
|
||||
b.get_spent(tx.id, 0)
|
||||
|
||||
def test_double_inclusion(self, b, alice):
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.backend.exceptions import OperationError
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.backend.exceptions import OperationError
|
||||
|
||||
tx = Transaction.create([alice.public_key], [([alice.public_key], 1)])
|
||||
tx = tx.sign([alice.private_key])
|
||||
@ -56,7 +56,7 @@ class TestBigchainApi(object):
|
||||
b.store_bulk_transactions([tx])
|
||||
|
||||
def test_text_search(self, b, alice):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# define the assets
|
||||
asset1 = {'msg': 'Planetmint 1'}
|
||||
@ -81,9 +81,9 @@ class TestBigchainApi(object):
|
||||
@pytest.mark.usefixtures('inputs')
|
||||
def test_non_create_input_not_found(self, b, user_pk):
|
||||
from cryptoconditions import Ed25519Sha256
|
||||
from bigchaindb.common.exceptions import InputDoesNotExist
|
||||
from bigchaindb.common.transaction import Input, TransactionLink
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.exceptions import InputDoesNotExist
|
||||
from planetmint.common.transaction import Input, TransactionLink
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# Create an input for a non existing transaction
|
||||
input = Input(Ed25519Sha256(public_key=b58decode(user_pk)),
|
||||
@ -95,7 +95,7 @@ class TestBigchainApi(object):
|
||||
tx.validate(b)
|
||||
|
||||
def test_write_transaction(self, b, user_sk, user_pk, alice, create_tx):
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.models import Transaction
|
||||
|
||||
asset1 = {'msg': 'Planetmint 1'}
|
||||
|
||||
@ -117,8 +117,8 @@ class TestBigchainApi(object):
|
||||
class TestTransactionValidation(object):
|
||||
|
||||
def test_non_create_input_not_found(self, b, signed_transfer_tx):
|
||||
from bigchaindb.common.exceptions import InputDoesNotExist
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from planetmint.common.exceptions import InputDoesNotExist
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
|
||||
signed_transfer_tx.inputs[0].fulfills = TransactionLink('c', 0)
|
||||
with pytest.raises(InputDoesNotExist):
|
||||
@ -126,9 +126,9 @@ class TestTransactionValidation(object):
|
||||
|
||||
@pytest.mark.usefixtures('inputs')
|
||||
def test_non_create_valid_input_wrong_owner(self, b, user_pk):
|
||||
from bigchaindb.common.crypto import generate_key_pair
|
||||
from bigchaindb.common.exceptions import InvalidSignature
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
from planetmint.common.exceptions import InvalidSignature
|
||||
from planetmint.models import Transaction
|
||||
|
||||
input_tx = b.fastquery.get_outputs_by_public_key(user_pk).pop()
|
||||
input_transaction = b.get_transaction(input_tx.txid)
|
||||
@ -144,7 +144,7 @@ class TestTransactionValidation(object):
|
||||
@pytest.mark.usefixtures('inputs')
|
||||
def test_non_create_double_spend(self, b, signed_create_tx,
|
||||
signed_transfer_tx, double_spend_tx):
|
||||
from bigchaindb.common.exceptions import DoubleSpend
|
||||
from planetmint.common.exceptions import DoubleSpend
|
||||
|
||||
b.store_bulk_transactions([signed_create_tx, signed_transfer_tx])
|
||||
|
||||
@ -156,8 +156,8 @@ class TestMultipleInputs(object):
|
||||
|
||||
def test_transfer_single_owner_single_input(self, b, inputs, user_pk,
|
||||
user_sk):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
|
||||
@ -177,8 +177,8 @@ class TestMultipleInputs(object):
|
||||
user_sk,
|
||||
user_pk,
|
||||
inputs):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
user3_sk, user3_pk = crypto.generate_key_pair()
|
||||
@ -199,8 +199,8 @@ class TestMultipleInputs(object):
|
||||
user_sk,
|
||||
user_pk,
|
||||
alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
user3_sk, user3_pk = crypto.generate_key_pair()
|
||||
@ -227,8 +227,8 @@ class TestMultipleInputs(object):
|
||||
user_sk,
|
||||
user_pk,
|
||||
alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
user3_sk, user3_pk = crypto.generate_key_pair()
|
||||
@ -252,9 +252,9 @@ class TestMultipleInputs(object):
|
||||
assert len(tx.outputs) == 1
|
||||
|
||||
def test_get_owned_ids_single_tx_single_output(self, b, user_sk, user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
|
||||
@ -280,9 +280,9 @@ class TestMultipleInputs(object):
|
||||
|
||||
def test_get_owned_ids_single_tx_multiple_outputs(self, b, user_sk,
|
||||
user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
|
||||
@ -314,9 +314,9 @@ class TestMultipleInputs(object):
|
||||
TransactionLink(tx_transfer.id, 1)]
|
||||
|
||||
def test_get_owned_ids_multiple_owners(self, b, user_sk, user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
user3_sk, user3_pk = crypto.generate_key_pair()
|
||||
@ -346,8 +346,8 @@ class TestMultipleInputs(object):
|
||||
assert not spent_user1
|
||||
|
||||
def test_get_spent_single_tx_single_output(self, b, user_sk, user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
|
||||
@ -372,8 +372,8 @@ class TestMultipleInputs(object):
|
||||
assert spent_inputs_user1 == tx
|
||||
|
||||
def test_get_spent_single_tx_multiple_outputs(self, b, user_sk, user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# create a new users
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
@ -409,8 +409,8 @@ class TestMultipleInputs(object):
|
||||
assert b.get_spent(tx_create.to_inputs()[2].fulfills.txid, 2) is None
|
||||
|
||||
def test_get_spent_multiple_owners(self, b, user_sk, user_pk, alice):
|
||||
from bigchaindb.common import crypto
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common import crypto
|
||||
from planetmint.models import Transaction
|
||||
|
||||
user2_sk, user2_pk = crypto.generate_key_pair()
|
||||
user3_sk, user3_pk = crypto.generate_key_pair()
|
||||
@ -445,8 +445,8 @@ class TestMultipleInputs(object):
|
||||
|
||||
|
||||
def test_get_outputs_filtered_only_unspent():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.lib import BigchainDB
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.lib import BigchainDB
|
||||
|
||||
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
|
||||
with patch(go) as get_outputs:
|
||||
@ -461,8 +461,8 @@ def test_get_outputs_filtered_only_unspent():
|
||||
|
||||
|
||||
def test_get_outputs_filtered_only_spent():
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.lib import BigchainDB
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.lib import BigchainDB
|
||||
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
|
||||
with patch(go) as get_outputs:
|
||||
get_outputs.return_value = [TransactionLink('a', 1),
|
||||
@ -478,8 +478,8 @@ def test_get_outputs_filtered_only_spent():
|
||||
@patch('bigchaindb.fastquery.FastQuery.filter_unspent_outputs')
|
||||
@patch('bigchaindb.fastquery.FastQuery.filter_spent_outputs')
|
||||
def test_get_outputs_filtered(filter_spent, filter_unspent):
|
||||
from bigchaindb.common.transaction import TransactionLink
|
||||
from bigchaindb.lib import BigchainDB
|
||||
from planetmint.common.transaction import TransactionLink
|
||||
from planetmint.lib import BigchainDB
|
||||
|
||||
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
|
||||
with patch(go) as get_outputs:
|
||||
@ -496,8 +496,8 @@ def test_cant_spend_same_input_twice_in_tx(b, alice):
|
||||
"""Recreate duplicated fulfillments bug
|
||||
https://github.com/bigchaindb/bigchaindb/issues/1099
|
||||
"""
|
||||
from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import DoubleSpend
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.exceptions import DoubleSpend
|
||||
|
||||
# create a divisible asset
|
||||
tx_create = Transaction.create([alice.public_key], [([alice.public_key], 100)])
|
||||
@ -517,8 +517,8 @@ def test_cant_spend_same_input_twice_in_tx(b, alice):
|
||||
|
||||
def test_transaction_unicode(b, alice):
|
||||
import copy
|
||||
from bigchaindb.common.utils import serialize
|
||||
from bigchaindb.models import Transaction
|
||||
from planetmint.common.utils import serialize
|
||||
from planetmint.models import Transaction
|
||||
|
||||
# http://www.fileformat.info/info/unicode/char/1f37a/index.htm
|
||||
beer_python = {'beer': '\N{BEER MUG}'}
|
||||
|
@ -2,10 +2,10 @@ import pytest
|
||||
|
||||
from tests.utils import generate_election, generate_validators
|
||||
|
||||
from bigchaindb.lib import Block
|
||||
from bigchaindb.elections.election import Election
|
||||
from bigchaindb.migrations.chain_migration_election import ChainMigrationElection
|
||||
from bigchaindb.upsert_validator.validator_election import ValidatorElection
|
||||
from planetmint.lib import Block
|
||||
from planetmint.elections.election import Election
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint.upsert_validator.validator_election import ValidatorElection
|
||||
|
||||
|
||||
@pytest.mark.bdb
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user