Annihilate the sandbox

pull/1983/head
Kieran Prasch 2020-05-12 20:21:15 -07:00
parent 92446ddbff
commit a935dc8e2d
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
88 changed files with 136 additions and 186 deletions

View File

@ -9,7 +9,7 @@ from nucypher.characters.lawful import Alice, Bob, Ursula
from nucypher.characters.lawful import Enrico as Enrico from nucypher.characters.lawful import Enrico as Enrico
from nucypher.network.middleware import RestMiddleware from nucypher.network.middleware import RestMiddleware
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
###################### ######################
# Boring setup stuff # # Boring setup stuff #

View File

@ -17,7 +17,7 @@ from nucypher.utilities.logging import GlobalLoggerSettings
# Twisted Logger # Twisted Logger
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
GlobalLoggerSettings.start_console_logging() GlobalLoggerSettings.start_console_logging()

View File

@ -16,7 +16,7 @@ from nucypher.network.middleware import RestMiddleware
from umbral.keys import UmbralPublicKey from umbral.keys import UmbralPublicKey
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
GlobalLoggerSettings.start_console_logging() GlobalLoggerSettings.start_console_logging()

View File

@ -92,7 +92,7 @@ def _get_auto_provider(provider_uri):
def _get_pyevm_test_backend() -> PyEVMBackend: def _get_pyevm_test_backend() -> PyEVMBackend:
from nucypher.utilities.sandbox.constants import PYEVM_GAS_LIMIT, NUMBER_OF_ETH_TEST_ACCOUNTS from tests.utils.constants import PYEVM_GAS_LIMIT, NUMBER_OF_ETH_TEST_ACCOUNTS
# Initialize # Initialize
genesis_params = PyEVMBackend._generate_genesis_params(overrides={'gas_limit': PYEVM_GAS_LIMIT}) genesis_params = PyEVMBackend._generate_genesis_params(overrides={'gas_limit': PYEVM_GAS_LIMIT})

View File

@ -2,12 +2,10 @@ import inspect
import json import json
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from json import JSONDecodeError from json import JSONDecodeError
from typing import Callable
import maya import maya
from flask import Response, Flask from flask import Response, Flask
from hendrix.deploy.base import HendrixDeploy from hendrix.deploy.base import HendrixDeploy
from marshmallow import Schema
from twisted.internet import reactor, stdio from twisted.internet import reactor, stdio
from twisted.logger import Logger from twisted.logger import Logger
@ -16,7 +14,7 @@ from nucypher.characters.control.interfaces import CharacterPublicInterface
from nucypher.characters.control.specifications.exceptions import SpecificationError from nucypher.characters.control.specifications.exceptions import SpecificationError
from nucypher.config.constants import MAX_UPLOAD_CONTENT_LENGTH from nucypher.config.constants import MAX_UPLOAD_CONTENT_LENGTH
from nucypher.cli.processes import JSONRPCLineReceiver from nucypher.cli.processes import JSONRPCLineReceiver
from nucypher.utilities.controllers import JSONRPCTestClient from tests.utils.controllers import JSONRPCTestClient
class CharacterControllerBase(ABC): class CharacterControllerBase(ABC):

View File

@ -21,8 +21,8 @@ from eth_tester.exceptions import ValidationError
from nucypher.characters.lawful import Ursula, Alice from nucypher.characters.lawful import Ursula, Alice
from nucypher.crypto.powers import CryptoPower, SigningPower from nucypher.crypto.powers import CryptoPower, SigningPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD, MOCK_URSULA_DB_FILEPATH from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD, MOCK_URSULA_DB_FILEPATH
from nucypher.utilities.sandbox.middleware import EvilMiddleWare from tests.utils.middleware import EvilMiddleWare
class Vladimir(Ursula): class Vladimir(Ursula):

View File

@ -186,7 +186,7 @@ def handle_client_account_for_staking(emitter: StdoutEmitter,
return client_account, staking_address return client_account, staking_address
def select_network(emitter) -> str: def select_network(emitter: StdoutEmitter) -> str:
headers = ["Network"] headers = ["Network"]
rows = [[n] for n in NetworksInventory.NETWORKS] rows = [[n] for n in NetworksInventory.NETWORKS]
emitter.echo(tabulate(rows, headers=headers, showindex='always')) emitter.echo(tabulate(rows, headers=headers, showindex='always'))

View File

@ -62,7 +62,7 @@ from nucypher.config.characters import AliceConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_ALICE_ETH_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_ALICE_ETH_PASSWORD
from nucypher.config.keyring import NucypherKeyring from nucypher.config.keyring import NucypherKeyring
from nucypher.network.middleware import RestMiddleware from nucypher.network.middleware import RestMiddleware
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
option_bob_verifying_key = click.option( option_bob_verifying_key = click.option(
'--bob-verifying-key', '--bob-verifying-key',

View File

@ -35,7 +35,7 @@ from nucypher.cli.painting.help import paint_new_installation_help
from nucypher.config.characters import BobConfiguration from nucypher.config.characters import BobConfiguration
from nucypher.crypto.powers import DecryptingPower from nucypher.crypto.powers import DecryptingPower
from nucypher.network.middleware import RestMiddleware from nucypher.network.middleware import RestMiddleware
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
class BobConfigOptions: class BobConfigOptions:

View File

@ -333,7 +333,9 @@ def upgrade(general_config, actor_options, retarget, target_address, ignore_depl
trustee_address = select_client_account(emitter=emitter, trustee_address = select_client_account(emitter=emitter,
prompt="Select trustee address", prompt="Select trustee address",
provider_uri=actor_options.provider_uri, provider_uri=actor_options.provider_uri,
show_balances=False) # FIXME: Unexpected argument!!! show_eth_balance=False,
show_nu_balance=False,
show_staking=False)
if not actor_options.force: if not actor_options.force:
click.confirm(CONFIRM_SELECTED_ACCOUNT.format(address=trustee_address), abort=True) click.confirm(CONFIRM_SELECTED_ACCOUNT.format(address=trustee_address), abort=True)

View File

@ -67,7 +67,7 @@ from nucypher.cli.types import EIP55_CHECKSUM_ADDRESS, NETWORK_PORT
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_WORKER_ETH_PASSWORD, NUCYPHER_ENVVAR_WORKER_IP_ADDRESS from nucypher.config.constants import NUCYPHER_ENVVAR_WORKER_ETH_PASSWORD, NUCYPHER_ENVVAR_WORKER_IP_ADDRESS
from nucypher.config.keyring import NucypherKeyring from nucypher.config.keyring import NucypherKeyring
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
class UrsulaConfigOptions: class UrsulaConfigOptions:

View File

@ -184,7 +184,7 @@ def wrap_option(handler, **options):
def process_middleware(mock_networking): def process_middleware(mock_networking):
from nucypher.network.middleware import RestMiddleware from nucypher.network.middleware import RestMiddleware
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
if mock_networking: if mock_networking:
middleware = MockRestMiddleware() middleware = MockRestMiddleware()
else: else:

View File

@ -56,7 +56,7 @@ class UrsulaCommandProtocol(LineReceiver):
'status': self.paintStatus, 'status': self.paintStatus,
'known_nodes': self.paintKnownNodes, 'known_nodes': self.paintKnownNodes,
'fleet_state': self.paintFleetState, 'fleet_state': self.paintFleetState,
# 'stakes': self.paintStakes, # TODO # 'stakes': self.paintStakes, # TODO: Paint stakes via ursula interactive console
# Blockchain Control # Blockchain Control
# TODO #1970 # TODO #1970

View File

@ -1,16 +0,0 @@
"""
This file is part of nucypher.
nucypher is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
nucypher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""

View File

@ -25,7 +25,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
from click.testing import CliRunner from click.testing import CliRunner
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.utilities.sandbox.constants import select_test_port from tests.utils.constants import select_test_port
click_runner = CliRunner() click_runner = CliRunner()

View File

View File

@ -7,14 +7,13 @@ from eth_utils import to_checksum_address
from nucypher.blockchain.eth.actors import ContractAdministrator from nucypher.blockchain.eth.actors import ContractAdministrator
from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainDeployerInterface, \ from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainDeployerInterface, \
BlockchainInterfaceFactory BlockchainInterfaceFactory
from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.crypto.api import verify_eip_191 from nucypher.crypto.api import verify_eip_191
# #
# NOTE: This module is skipped on CI # NOTE: This module is skipped on CI
# #
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
def test_geth_EIP_191_client_signature_integration(instant_geth_dev_node): def test_geth_EIP_191_client_signature_integration(instant_geth_dev_node):

View File

@ -14,7 +14,7 @@ from eth_utils import to_checksum_address
from hexbytes import HexBytes from hexbytes import HexBytes
from nucypher.blockchain.eth.signers import KeystoreSigner, Signer from nucypher.blockchain.eth.signers import KeystoreSigner, Signer
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
# Example keystore filename # Example keystore filename
MOCK_KEYFILE_NAME = 'UTC--2019-12-04T05-39-04.006429310Z--0xdeadbeef' MOCK_KEYFILE_NAME = 'UTC--2019-12-04T05-39-04.006429310Z--0xdeadbeef'

View File

@ -18,6 +18,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import pytest import pytest
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD
from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
# Experimental max error # Experimental max error
MAX_ERROR_FIRST_PHASE = 1e-20 MAX_ERROR_FIRST_PHASE = 1e-20

View File

@ -15,12 +15,10 @@ You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>. along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import os
import pytest import pytest
from web3.contract import Contract from web3.contract import Contract
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
@pytest.fixture() @pytest.fixture()

View File

@ -27,7 +27,7 @@ from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory, Block
from nucypher.blockchain.eth.registry import InMemoryContractRegistry from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
USER = "nucypher" USER = "nucypher"
REPO = "nucypher" REPO = "nucypher"

View File

@ -1,8 +1,8 @@
import pytest import pytest
from nucypher.blockchain.eth.actors import Staker from nucypher.blockchain.eth.actors import Staker
from nucypher.utilities.sandbox.blockchain import token_airdrop from tests.utils.blockchain import token_airdrop
from nucypher.utilities.sandbox.constants import DEVELOPMENT_TOKEN_AIRDROP_AMOUNT from tests.utils.constants import DEVELOPMENT_TOKEN_AIRDROP_AMOUNT
@pytest.fixture(scope='module') @pytest.fixture(scope='module')

View File

@ -25,8 +25,8 @@ from nucypher.blockchain.eth.sol.compile import SolidityCompiler
from nucypher.characters.control.emitters import StdoutEmitter from nucypher.characters.control.emitters import StdoutEmitter
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
# Prevents TesterBlockchain to be picked up by py.test as a test class # Prevents TesterBlockchain to be picked up by py.test as a test class
from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlockchain from tests.utils.blockchain import TesterBlockchain as _TesterBlockchain
from nucypher.utilities.sandbox.constants import NUMBER_OF_ALLOCATIONS_IN_TESTS, INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import NUMBER_OF_ALLOCATIONS_IN_TESTS, INSECURE_DEVELOPMENT_PASSWORD
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -24,7 +24,7 @@ from nucypher.blockchain.eth.actors import Staker, Investigator
from nucypher.blockchain.eth.constants import NULL_ADDRESS from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.crypto.signing import SignatureStamp from nucypher.crypto.signing import SignatureStamp
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
def mock_ursula(testerchain, account, mocker): def mock_ursula(testerchain, account, mocker):

View File

@ -17,7 +17,6 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import pytest import pytest
from nucypher.blockchain.eth.actors import BlockchainPolicyAuthor from nucypher.blockchain.eth.actors import BlockchainPolicyAuthor
from nucypher.utilities.sandbox.constants import DEVELOPMENT_ETH_AIRDROP_AMOUNT
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -18,15 +18,13 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import pytest import pytest
from eth_tester.exceptions import TransactionFailed from eth_tester.exceptions import TransactionFailed
from tests.utils.ursula import make_decentralized_ursulas
from tests.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.blockchain.eth.actors import Staker
from nucypher.blockchain.eth.agents import ContractAgency, StakingEscrowAgent from nucypher.blockchain.eth.agents import ContractAgency, StakingEscrowAgent
from nucypher.blockchain.eth.token import NU, Stake from nucypher.blockchain.eth.token import NU, Stake
from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.blockchain import token_airdrop
from nucypher.utilities.sandbox.constants import DEVELOPMENT_TOKEN_AIRDROP_AMOUNT, INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.ursula import make_decentralized_ursulas
from tests.fixtures import FEE_RATE_RANGE from tests.fixtures import FEE_RATE_RANGE
from tests.utils.ursula import make_decentralized_ursulas
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -3,11 +3,9 @@ import pytest_twisted
from twisted.internet import threads from twisted.internet import threads
from twisted.internet.task import Clock from twisted.internet.task import Clock
from nucypher.blockchain.eth.actors import Worker
from nucypher.blockchain.eth.token import NU, WorkTracker from nucypher.blockchain.eth.token import NU, WorkTracker
from nucypher.crypto.powers import TransactingPower from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.ursula import make_decentralized_ursulas, start_pytest_ursula_services
from nucypher.utilities.sandbox.ursula import make_decentralized_ursulas, start_pytest_ursula_services
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -25,7 +25,7 @@ from nucypher.blockchain.eth.agents import AdjudicatorAgent
from nucypher.blockchain.eth.constants import NULL_ADDRESS from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.crypto.signing import SignatureStamp from nucypher.crypto.signing import SignatureStamp
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
def mock_ursula(testerchain, account, mocker): def mock_ursula(testerchain, account, mocker):

View File

@ -14,17 +14,17 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>. along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import os
import collections import collections
import os
import pytest import pytest
from eth_tester.exceptions import TransactionFailed from eth_tester.exceptions import TransactionFailed
from eth_utils import is_checksum_address, to_wei from eth_utils import is_checksum_address, to_wei
from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.blockchain.eth.agents import PolicyManagerAgent, ContractAgency from nucypher.blockchain.eth.agents import ContractAgency, PolicyManagerAgent
from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD
from tests.fixtures import FEE_RATE_RANGE from tests.fixtures import FEE_RATE_RANGE
MockPolicyMetadata = collections.namedtuple('MockPolicyMetadata', 'policy_id author addresses') MockPolicyMetadata = collections.namedtuple('MockPolicyMetadata', 'policy_id author addresses')

View File

@ -25,8 +25,8 @@ from nucypher.blockchain.eth.agents import PreallocationEscrowAgent
from nucypher.blockchain.eth.deployers import PreallocationEscrowDeployer from nucypher.blockchain.eth.deployers import PreallocationEscrowDeployer
from nucypher.blockchain.eth.registry import InMemoryAllocationRegistry from nucypher.blockchain.eth.registry import InMemoryAllocationRegistry
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.utilities.sandbox.blockchain import token_airdrop from tests.utils.blockchain import token_airdrop
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
TEST_LOCK_DURATION_IN_SECONDS = 60 * 60 * 24 # 1 day TEST_LOCK_DURATION_IN_SECONDS = 60 * 60 * 24 # 1 day
TEST_ALLOCATION_REGISTRY = InMemoryAllocationRegistry() TEST_ALLOCATION_REGISTRY = InMemoryAllocationRegistry()

View File

@ -24,7 +24,7 @@ from eth_utils.address import to_checksum_address, is_address
from nucypher.blockchain.eth.agents import StakingEscrowAgent, ContractAgency from nucypher.blockchain.eth.agents import StakingEscrowAgent, ContractAgency
from nucypher.blockchain.eth.constants import NULL_ADDRESS from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.registry import BaseContractRegistry from nucypher.blockchain.eth.registry import BaseContractRegistry
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -18,9 +18,8 @@ import pytest
from eth_tester.exceptions import TransactionFailed from eth_tester.exceptions import TransactionFailed
from nucypher.blockchain.eth.agents import NucypherTokenAgent from nucypher.blockchain.eth.agents import NucypherTokenAgent
from nucypher.blockchain.eth.deployers import NucypherTokenDeployer, DispatcherDeployer from nucypher.blockchain.eth.deployers import NucypherTokenDeployer
from nucypher.crypto.powers import TransactingPower from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD
@pytest.fixture(scope='module') @pytest.fixture(scope='module')

View File

@ -14,7 +14,6 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>. along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import os
import pytest import pytest
from eth_tester.exceptions import TransactionFailed from eth_tester.exceptions import TransactionFailed
@ -28,8 +27,8 @@ from nucypher.blockchain.eth.deployers import (NucypherTokenDeployer,
AdjudicatorDeployer, AdjudicatorDeployer,
BaseContractDeployer) BaseContractDeployer)
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.blockchain import token_airdrop from tests.utils.blockchain import token_airdrop
from nucypher.utilities.sandbox.constants import DEVELOPMENT_TOKEN_AIRDROP_AMOUNT, INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import DEVELOPMENT_TOKEN_AIRDROP_AMOUNT, INSECURE_DEVELOPMENT_PASSWORD
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -24,8 +24,8 @@ from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
# Prevents TesterBlockchain to be picked up by py.test as a test class # Prevents TesterBlockchain to be picked up by py.test as a test class
from nucypher.utilities.sandbox.blockchain import TesterBlockchain as _TesterBlockchain from tests.utils.blockchain import TesterBlockchain as _TesterBlockchain
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
DEVELOPMENT_ETH_AIRDROP_AMOUNT, DEVELOPMENT_ETH_AIRDROP_AMOUNT,
NUMBER_OF_ETH_TEST_ACCOUNTS, NUMBER_OF_ETH_TEST_ACCOUNTS,
NUMBER_OF_STAKERS_IN_BLOCKCHAIN_TESTS, NUMBER_OF_STAKERS_IN_BLOCKCHAIN_TESTS,

View File

@ -21,7 +21,7 @@ import pytest
from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME
from nucypher.blockchain.eth.interfaces import BaseContractRegistry from nucypher.blockchain.eth.interfaces import BaseContractRegistry
from nucypher.blockchain.eth.registry import LocalContractRegistry, IndividualAllocationRegistry from nucypher.blockchain.eth.registry import LocalContractRegistry, IndividualAllocationRegistry
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
def test_contract_registry(tempfile_path): def test_contract_registry(tempfile_path):

View File

@ -19,7 +19,7 @@ from os.path import dirname, abspath
from nucypher.blockchain.eth.deployers import NucypherTokenDeployer from nucypher.blockchain.eth.deployers import NucypherTokenDeployer
from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs from nucypher.blockchain.eth.sol.compile import SolidityCompiler, SourceDirs
from nucypher.utilities.sandbox.blockchain import TesterBlockchain from tests.utils.blockchain import TesterBlockchain
def test_nucypher_contract_compiled(testerchain, test_registry): def test_nucypher_contract_compiled(testerchain, test_registry):

View File

@ -3,9 +3,8 @@ from decimal import InvalidOperation, Decimal
import pytest import pytest
from web3 import Web3 from web3 import Web3
from nucypher.blockchain.economics import StandardTokenEconomics, StandardTokenEconomics
from nucypher.blockchain.eth.token import NU, Stake from nucypher.blockchain.eth.token import NU, Stake
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
def test_NU(token_economics): def test_NU(token_economics):

View File

@ -27,8 +27,8 @@ from nucypher.config.characters import AliceConfiguration
from nucypher.crypto.api import keccak_digest from nucypher.crypto.api import keccak_digest
from nucypher.crypto.powers import SigningPower, DecryptingPower from nucypher.crypto.powers import SigningPower, DecryptingPower
from nucypher.policy.collections import Revocation, PolicyCredential from nucypher.policy.collections import Revocation, PolicyCredential
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
@pytest.mark.usefixtures('blockchain_ursulas') @pytest.mark.usefixtures('blockchain_ursulas')

View File

@ -23,10 +23,10 @@ from umbral.cfrags import CapsuleFrag
from umbral.kfrags import KFrag from umbral.kfrags import KFrag
from nucypher.crypto.kits import PolicyMessageKit from nucypher.crypto.kits import PolicyMessageKit
from nucypher.utilities.sandbox.middleware import NodeIsDownMiddleware from tests.utils.middleware import NodeIsDownMiddleware
from nucypher.crypto.powers import DecryptingPower from nucypher.crypto.powers import DecryptingPower
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
def test_bob_cannot_follow_the_treasure_map_in_isolation(enacted_federated_policy, federated_bob): def test_bob_cannot_follow_the_treasure_map_in_isolation(enacted_federated_policy, federated_bob):

View File

@ -11,12 +11,12 @@ from twisted.internet.task import Clock
from nucypher.characters.lawful import Bob, Ursula from nucypher.characters.lawful import Bob, Ursula
from nucypher.characters.lawful import Enrico from nucypher.characters.lawful import Enrico
from nucypher.policy.collections import TreasureMap from nucypher.policy.collections import TreasureMap
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK, NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK,
MOCK_POLICY_DEFAULT_M, MOCK_POLICY_DEFAULT_M,
TEMPORARY_DOMAIN TEMPORARY_DOMAIN
) )
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
def test_federated_bob_full_retrieve_flow(federated_ursulas, def test_federated_bob_full_retrieve_flow(federated_ursulas,

View File

@ -31,7 +31,7 @@ from nucypher.crypto.powers import (CryptoPower,
SigningPower, SigningPower,
NoSigningPower, NoSigningPower,
TransactingPower) TransactingPower)
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
""" """
Chapter 1: SIGNING Chapter 1: SIGNING

View File

@ -5,8 +5,7 @@ import pytest
from nucypher.blockchain.eth.actors import Worker from nucypher.blockchain.eth.actors import Worker
from nucypher.blockchain.eth.agents import StakingEscrowAgent, ContractAgency from nucypher.blockchain.eth.agents import StakingEscrowAgent, ContractAgency
from nucypher.config.characters import StakeHolderConfiguration from nucypher.config.characters import StakeHolderConfiguration
from nucypher.crypto.powers import TransactingPower from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD
def test_software_stakeholder_configuration(testerchain, def test_software_stakeholder_configuration(testerchain,

View File

@ -25,9 +25,9 @@ from nucypher.characters.unlawful import Vladimir
from nucypher.crypto.api import verify_eip_191 from nucypher.crypto.api import verify_eip_191
from nucypher.crypto.powers import SigningPower from nucypher.crypto.powers import SigningPower
from nucypher.policy.policies import Policy from nucypher.policy.policies import Policy
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.middleware import MockRestMiddleware, NodeIsDownMiddleware from tests.utils.middleware import MockRestMiddleware, NodeIsDownMiddleware
from nucypher.utilities.sandbox.ursula import make_federated_ursulas, make_decentralized_ursulas from tests.utils.ursula import make_federated_ursulas, make_decentralized_ursulas
def test_new_federated_ursula_announces_herself(ursula_federated_test_config): def test_new_federated_ursula_announces_herself(ursula_federated_test_config):

View File

@ -27,7 +27,7 @@ from datetime import datetime
from nucypher.blockchain.eth.registry import InMemoryContractRegistry, LocalContractRegistry from nucypher.blockchain.eth.registry import InMemoryContractRegistry, LocalContractRegistry
from nucypher.config.characters import UrsulaConfiguration, StakeHolderConfiguration from nucypher.config.characters import UrsulaConfiguration, StakeHolderConfiguration
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
BASE_TEMP_DIR, BASE_TEMP_DIR,
BASE_TEMP_PREFIX, BASE_TEMP_PREFIX,
DATETIME_FORMAT, DATETIME_FORMAT,

View File

@ -25,7 +25,6 @@ from nucypher.blockchain.eth.agents import ContractAgency
from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainInterfaceFactory from nucypher.blockchain.eth.interfaces import BlockchainInterface, BlockchainInterfaceFactory
from nucypher.blockchain.eth.registry import InMemoryContractRegistry from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.utilities.sandbox.constants import MOCK_PROVIDER_URI
from tests.cli.functional.test_ursula_local_keystore_cli_functionality import NUMBER_OF_MOCK_ACCOUNTS, \ from tests.cli.functional.test_ursula_local_keystore_cli_functionality import NUMBER_OF_MOCK_ACCOUNTS, \
KEYFILE_NAME_TEMPLATE KEYFILE_NAME_TEMPLATE
from tests.fixtures import _make_testerchain, make_token_economics from tests.fixtures import _make_testerchain, make_token_economics

View File

@ -25,7 +25,7 @@ from nucypher.blockchain.eth.token import StakeList
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD, NUCYPHER_ENVVAR_WORKER_ETH_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD, NUCYPHER_ENVVAR_WORKER_ETH_PASSWORD
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
MOCK_URSULA_STARTING_PORT, MOCK_URSULA_STARTING_PORT,

View File

@ -24,7 +24,7 @@ from nucypher.blockchain.eth.actors import Bidder
from nucypher.blockchain.eth.interfaces import BlockchainInterface from nucypher.blockchain.eth.interfaces import BlockchainInterface
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.cli.commands.worklock import worklock from nucypher.cli.commands.worklock import worklock
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEMPORARY_DOMAIN, MOCK_PROVIDER_URI, YES, TEMPORARY_DOMAIN, MOCK_PROVIDER_URI, YES,
) )
from tests.cli.functional.test_ursula_local_keystore_cli_functionality import CLI_ENV from tests.cli.functional.test_ursula_local_keystore_cli_functionality import CLI_ENV

View File

@ -5,7 +5,7 @@ from nucypher.cli.literature import SUCCESSFUL_DESTRUCTION
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import AliceConfiguration from nucypher.config.characters import AliceConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,
MOCK_CUSTOM_INSTALLATION_PATH, MOCK_CUSTOM_INSTALLATION_PATH,

View File

@ -14,8 +14,8 @@ from nucypher.config.characters import BobConfiguration
from nucypher.crypto.kits import UmbralMessageKit from nucypher.crypto.kits import UmbralMessageKit
from nucypher.crypto.powers import SigningPower from nucypher.crypto.powers import SigningPower
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD, TEMPORARY_DOMAIN from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD, TEMPORARY_DOMAIN
from nucypher.utilities.sandbox.constants import MOCK_IP_ADDRESS, MOCK_CUSTOM_INSTALLATION_PATH from tests.utils.constants import MOCK_IP_ADDRESS, MOCK_CUSTOM_INSTALLATION_PATH
log = Logger() log = Logger()

View File

@ -7,7 +7,7 @@ from nucypher.blockchain.eth.registry import InMemoryContractRegistry
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import AliceConfiguration, BobConfiguration, UrsulaConfiguration from nucypher.config.characters import AliceConfiguration, BobConfiguration, UrsulaConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD, NUCYPHER_ENVVAR_WORKER_IP_ADDRESS from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD, NUCYPHER_ENVVAR_WORKER_IP_ADDRESS
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEMPORARY_DOMAIN, TEMPORARY_DOMAIN,
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
MOCK_CUSTOM_INSTALLATION_PATH, MOCK_CUSTOM_INSTALLATION_PATH,

View File

@ -17,8 +17,8 @@ from nucypher.config.characters import AliceConfiguration, BobConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.crypto.kits import UmbralMessageKit from nucypher.crypto.kits import UmbralMessageKit
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD, TEMPORARY_DOMAIN, TEST_PROVIDER_URI from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD, TEMPORARY_DOMAIN, TEST_PROVIDER_URI
from nucypher.utilities.sandbox.ursula import start_pytest_ursula_services from tests.utils.ursula import start_pytest_ursula_services
PLAINTEXT = "I'm bereaved, not a sap!" PLAINTEXT = "I'm bereaved, not a sap!"

View File

@ -16,7 +16,7 @@ from nucypher.blockchain.eth.interfaces import BlockchainInterface
from nucypher.blockchain.eth.registry import LocalContractRegistry from nucypher.blockchain.eth.registry import LocalContractRegistry
from nucypher.blockchain.eth.sol.compile import SOLIDITY_COMPILER_VERSION from nucypher.blockchain.eth.sol.compile import SOLIDITY_COMPILER_VERSION
from nucypher.cli.commands.deploy import deploy from nucypher.cli.commands.deploy import deploy
from nucypher.utilities.sandbox.constants import TEST_PROVIDER_URI from tests.utils.constants import TEST_PROVIDER_URI
PLANNED_UPGRADES = 4 PLANNED_UPGRADES = 4

View File

@ -16,7 +16,7 @@ from nucypher.blockchain.eth.constants import (
from nucypher.blockchain.eth.deployers import StakingEscrowDeployer from nucypher.blockchain.eth.deployers import StakingEscrowDeployer
from nucypher.blockchain.eth.registry import LocalContractRegistry, InMemoryContractRegistry from nucypher.blockchain.eth.registry import LocalContractRegistry, InMemoryContractRegistry
from nucypher.cli.commands.deploy import deploy from nucypher.cli.commands.deploy import deploy
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
) )

View File

@ -14,7 +14,7 @@ from nucypher.cli.literature import SUCCESSFUL_DESTRUCTION
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import FelixConfiguration from nucypher.config.characters import FelixConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEMPORARY_DOMAIN, TEMPORARY_DOMAIN,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,

View File

@ -9,7 +9,7 @@ from nucypher.config.characters import FelixConfiguration, UrsulaConfiguration,
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.config.keyring import NucypherKeyring from nucypher.config.keyring import NucypherKeyring
from nucypher.network.nodes import Teacher from nucypher.network.nodes import Teacher
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEMPORARY_DOMAIN, TEMPORARY_DOMAIN,
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,

View File

@ -8,7 +8,7 @@ from nucypher.blockchain.eth.agents import (
) )
from nucypher.blockchain.eth.registry import LocalContractRegistry from nucypher.blockchain.eth.registry import LocalContractRegistry
from nucypher.cli.commands.deploy import deploy from nucypher.cli.commands.deploy import deploy
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
) )

View File

@ -16,19 +16,20 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import random import random
import re import re
from nucypher.blockchain.eth.agents import ( from nucypher.blockchain.eth.agents import (
PolicyManagerAgent,
StakingEscrowAgent,
AdjudicatorAgent, AdjudicatorAgent,
ContractAgency,
NucypherTokenAgent, NucypherTokenAgent,
ContractAgency PolicyManagerAgent,
StakingEscrowAgent
) )
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.cli.commands.status import status from nucypher.cli.commands.status import status
from nucypher.utilities.sandbox.constants import TEST_PROVIDER_URI, TEMPORARY_DOMAIN
from tests.fixtures import FEE_RATE_RANGE from tests.fixtures import FEE_RATE_RANGE
from tests.utils.constants import TEMPORARY_DOMAIN, TEST_PROVIDER_URI
def test_nucypher_status_network(click_runner, testerchain, agency_local_registry): def test_nucypher_status_network(click_runner, testerchain, agency_local_registry):

View File

@ -30,7 +30,7 @@ from nucypher.blockchain.eth.agents import (
from nucypher.blockchain.eth.token import NU from nucypher.blockchain.eth.token import NU
from nucypher.characters.lawful import Ursula from nucypher.characters.lawful import Ursula
from nucypher.cli.commands.worklock import worklock from nucypher.cli.commands.worklock import worklock
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,

View File

@ -25,7 +25,7 @@ from nucypher.cli.literature import SUCCESSFUL_DESTRUCTION
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.constants import APP_DIR, DEFAULT_CONFIG_ROOT, NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import APP_DIR, DEFAULT_CONFIG_ROOT, NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
MOCK_CUSTOM_INSTALLATION_PATH, MOCK_CUSTOM_INSTALLATION_PATH,
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,

View File

@ -26,7 +26,7 @@ from nucypher.blockchain.eth.signers import KeystoreSigner
from nucypher.blockchain.eth.token import StakeList from nucypher.blockchain.eth.token import StakeList
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
MOCK_URSULA_STARTING_PORT, MOCK_URSULA_STARTING_PORT,

View File

@ -32,14 +32,14 @@ from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD from nucypher.config.constants import NUCYPHER_ENVVAR_KEYRING_PASSWORD
from nucypher.network.nodes import Teacher from nucypher.network.nodes import Teacher
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
MOCK_URSULA_STARTING_PORT, MOCK_URSULA_STARTING_PORT,
TEMPORARY_DOMAIN, TEMPORARY_DOMAIN,
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
MOCK_IP_ADDRESS MOCK_IP_ADDRESS
) )
from nucypher.utilities.sandbox.ursula import start_pytest_ursula_services from tests.utils.ursula import start_pytest_ursula_services
@mock.patch('glob.glob', return_value=list()) @mock.patch('glob.glob', return_value=list())

View File

@ -37,7 +37,7 @@ from nucypher.blockchain.eth.token import NU, Stake, StakeList
from nucypher.characters.lawful import Enrico, Ursula from nucypher.characters.lawful import Enrico, Ursula
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
TEST_PROVIDER_URI, TEST_PROVIDER_URI,
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
MOCK_IP_ADDRESS, MOCK_IP_ADDRESS,
@ -48,7 +48,7 @@ from nucypher.utilities.sandbox.constants import (
MOCK_INDIVIDUAL_ALLOCATION_FILEPATH, MOCK_INDIVIDUAL_ALLOCATION_FILEPATH,
ONE_YEAR_IN_SECONDS ONE_YEAR_IN_SECONDS
) )
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
# #
# This test module is intended to mirror tests/cli/ursula/test_stakeholder_and_ursula.py, # This test module is intended to mirror tests/cli/ursula/test_stakeholder_and_ursula.py,

View File

@ -16,30 +16,30 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import json import json
import os
import random import random
from unittest import mock from unittest import mock
import maya import maya
import os
from nucypher.utilities.sandbox.middleware import MockRestMiddleware
from tests.utils.constants import (INSECURE_DEVELOPMENT_PASSWORD,
MOCK_IP_ADDRESS,
MOCK_KNOWN_URSULAS_CACHE,
MOCK_URSULA_STARTING_PORT,
TEMPORARY_DOMAIN,
TEST_PROVIDER_URI,
select_test_port
)
from twisted.logger import Logger from twisted.logger import Logger
from nucypher.blockchain.eth.actors import Staker from nucypher.blockchain.eth.actors import Staker
from nucypher.blockchain.eth.agents import StakingEscrowAgent, ContractAgency from nucypher.blockchain.eth.agents import ContractAgency, StakingEscrowAgent
from nucypher.blockchain.eth.token import NU, Stake from nucypher.blockchain.eth.token import NU, Stake
from nucypher.characters.lawful import Enrico, Ursula from nucypher.characters.lawful import Enrico, Ursula
from nucypher.cli.main import nucypher_cli from nucypher.cli.main import nucypher_cli
from nucypher.config.characters import UrsulaConfiguration, StakeHolderConfiguration from nucypher.config.characters import StakeHolderConfiguration, UrsulaConfiguration
from nucypher.utilities.sandbox.constants import (
MOCK_IP_ADDRESS,
TEST_PROVIDER_URI,
MOCK_URSULA_STARTING_PORT,
INSECURE_DEVELOPMENT_PASSWORD,
TEMPORARY_DOMAIN,
MOCK_KNOWN_URSULAS_CACHE,
select_test_port,
)
from nucypher.utilities.sandbox.middleware import MockRestMiddleware
from tests.fixtures import FEE_RATE_RANGE from tests.fixtures import FEE_RATE_RANGE
from tests.utils.middleware import MockRestMiddleware
@mock.patch('nucypher.config.characters.StakeHolderConfiguration.default_filepath', return_value='/non/existent/file') @mock.patch('nucypher.config.characters.StakeHolderConfiguration.default_filepath', return_value='/non/existent/file')

View File

@ -1,21 +1,18 @@
import json
import os import os
import tempfile import tempfile
import click
import pytest import pytest
from constant_sorrow.constants import NO_KEYRING_ATTACHED, CERTIFICATE_NOT_SAVED, NO_BLOCKCHAIN_CONNECTION from constant_sorrow.constants import NO_KEYRING_ATTACHED, CERTIFICATE_NOT_SAVED
from nucypher.blockchain.eth.actors import StakeHolder from nucypher.blockchain.eth.actors import StakeHolder
from nucypher.characters.chaotic import Felix from nucypher.characters.chaotic import Felix
from nucypher.characters.lawful import Alice, Bob from nucypher.characters.lawful import Alice, Bob
from nucypher.characters.lawful import Ursula from nucypher.characters.lawful import Ursula
from nucypher.cli.actions import handle_missing_configuration_file
from nucypher.config.characters import AliceConfiguration, BobConfiguration, \ from nucypher.config.characters import AliceConfiguration, BobConfiguration, \
FelixConfiguration, StakeHolderConfiguration FelixConfiguration, StakeHolderConfiguration
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.config.storages import ForgetfulNodeStorage from nucypher.config.storages import ForgetfulNodeStorage
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN from tests.utils.constants import TEMPORARY_DOMAIN
# Main Cast # Main Cast
configurations = (AliceConfiguration, BobConfiguration, UrsulaConfiguration) configurations = (AliceConfiguration, BobConfiguration, UrsulaConfiguration)

View File

@ -5,7 +5,7 @@ from umbral.signing import Signer
from nucypher.config.keyring import NucypherKeyring from nucypher.config.keyring import NucypherKeyring
from nucypher.crypto.powers import DelegatingPower, DecryptingPower from nucypher.crypto.powers import DelegatingPower, DecryptingPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from constant_sorrow.constants import FEDERATED_ADDRESS from constant_sorrow.constants import FEDERATED_ADDRESS
from nucypher.characters.lawful import Alice, Bob, Ursula from nucypher.characters.lawful import Alice, Bob, Ursula

View File

@ -23,7 +23,7 @@ from nucypher.config.storages import (
SQLiteForgetfulNodeStorage, SQLiteForgetfulNodeStorage,
TemporaryFileBasedNodeStorage, TemporaryFileBasedNodeStorage,
NodeStorage) NodeStorage)
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
MOCK_URSULA_DB_FILEPATH, MOCK_URSULA_DB_FILEPATH,
MOCK_URSULA_STARTING_PORT) MOCK_URSULA_STARTING_PORT)

View File

@ -21,7 +21,7 @@ from nucypher.characters.control.emitters import WebEmitter
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.network.trackers import AvailabilityTracker from nucypher.network.trackers import AvailabilityTracker
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
# Crash on server error by default # Crash on server error by default
WebEmitter._crash_on_error_default = True WebEmitter._crash_on_error_default = True

View File

@ -3,11 +3,9 @@ from eth_account._utils.transactions import Transaction
from eth_utils import to_checksum_address from eth_utils import to_checksum_address
from nucypher.blockchain.eth.agents import NucypherTokenAgent from nucypher.blockchain.eth.agents import NucypherTokenAgent
from nucypher.blockchain.eth.signers import Signer
from nucypher.crypto.api import verify_eip_191 from nucypher.crypto.api import verify_eip_191
from nucypher.crypto.powers import (PowerUpError)
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from tests.conftest import LOCK_FUNCTION from tests.conftest import LOCK_FUNCTION
TransactingPower.lock_account = LOCK_FUNCTION TransactingPower.lock_account = LOCK_FUNCTION

View File

@ -17,7 +17,6 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
import random import random
import datetime import datetime
import json
import maya import maya
import os import os
import pytest import pytest
@ -65,8 +64,8 @@ from nucypher.datastore import datastore
from nucypher.datastore.db import Base from nucypher.datastore.db import Base
from nucypher.policy.collections import IndisputableEvidence, WorkOrder from nucypher.policy.collections import IndisputableEvidence, WorkOrder
from nucypher.utilities.logging import GlobalLoggerSettings from nucypher.utilities.logging import GlobalLoggerSettings
from nucypher.utilities.sandbox.blockchain import token_airdrop, TesterBlockchain from tests.utils.blockchain import token_airdrop, TesterBlockchain
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
DEVELOPMENT_ETH_AIRDROP_AMOUNT, DEVELOPMENT_ETH_AIRDROP_AMOUNT,
DEVELOPMENT_TOKEN_AIRDROP_AMOUNT, DEVELOPMENT_TOKEN_AIRDROP_AMOUNT,
MIN_STAKE_FOR_TESTS, MIN_STAKE_FOR_TESTS,
@ -80,11 +79,11 @@ from nucypher.utilities.sandbox.constants import (
INSECURE_DEVELOPMENT_PASSWORD, INSECURE_DEVELOPMENT_PASSWORD,
TEST_GAS_LIMIT, TEST_GAS_LIMIT,
) )
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
from nucypher.utilities.sandbox.middleware import MockRestMiddlewareForLargeFleetTests from tests.utils.middleware import MockRestMiddlewareForLargeFleetTests
from nucypher.utilities.sandbox.policy import generate_random_label from tests.utils.policy import generate_random_label
from nucypher.utilities.sandbox.ursula import make_decentralized_ursulas from tests.utils.ursula import make_decentralized_ursulas
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
from tests.mock.interfaces import make_mock_registry_source_manager, MockBlockchain from tests.mock.interfaces import make_mock_registry_source_manager, MockBlockchain
from tests.performance_mocks import ( from tests.performance_mocks import (
mock_cert_storage, mock_cert_storage,

View File

@ -1,8 +1,6 @@
from functools import partial from functools import partial
import pytest from tests.utils.ursula import make_federated_ursulas
from nucypher.utilities.sandbox.ursula import make_federated_ursulas
def test_learner_learns_about_domains_separately(ursula_federated_test_config, caplog): def test_learner_learns_about_domains_separately(ursula_federated_test_config, caplog):
lonely_ursula_maker = partial(make_federated_ursulas, lonely_ursula_maker = partial(make_federated_ursulas,

View File

@ -12,8 +12,8 @@ from nucypher.characters.base import Character
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.network.nicknames import nickname_from_seed from nucypher.network.nicknames import nickname_from_seed
from nucypher.network.nodes import FleetStateTracker, Learner from nucypher.network.nodes import FleetStateTracker, Learner
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
from nucypher.utilities.sandbox.ursula import make_federated_ursulas, make_ursula_for_staker from tests.utils.ursula import make_federated_ursulas, make_ursula_for_staker
def test_blockchain_ursula_stamp_verification_tolerance(blockchain_ursulas, mocker): def test_blockchain_ursula_stamp_verification_tolerance(blockchain_ursulas, mocker):

View File

@ -21,7 +21,7 @@ import pytest_twisted as pt
from twisted.internet.threads import deferToThread from twisted.internet.threads import deferToThread
from nucypher.network.middleware import RestMiddleware from nucypher.network.middleware import RestMiddleware
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
def test_proper_seed_node_instantiation(ursula_federated_test_config): def test_proper_seed_node_instantiation(ursula_federated_test_config):

View File

@ -1,7 +1,7 @@
from constant_sorrow.constants import FLEET_STATES_MATCH, NO_KNOWN_NODES from constant_sorrow.constants import FLEET_STATES_MATCH, NO_KNOWN_NODES
from hendrix.experience import crosstown_traffic from hendrix.experience import crosstown_traffic
from hendrix.utils.test_utils import crosstownTaskListDecoratorFactory from hendrix.utils.test_utils import crosstownTaskListDecoratorFactory
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
from functools import partial from functools import partial

View File

@ -38,7 +38,7 @@ from nucypher.blockchain.eth.agents import NucypherTokenAgent, StakingEscrowAgen
from nucypher.blockchain.eth.constants import NUCYPHER_CONTRACT_NAMES from nucypher.blockchain.eth.constants import NUCYPHER_CONTRACT_NAMES
from nucypher.crypto.signing import SignatureStamp from nucypher.crypto.signing import SignatureStamp
from nucypher.policy.policies import Policy from nucypher.policy.policies import Policy
from nucypher.utilities.sandbox.blockchain import TesterBlockchain from tests.utils.blockchain import TesterBlockchain
from umbral.keys import UmbralPrivateKey from umbral.keys import UmbralPrivateKey
from umbral.signing import Signer from umbral.signing import Signer

View File

@ -1,8 +1,6 @@
from collections import defaultdict from collections import defaultdict
from typing import Tuple from typing import Tuple
from functools import partial
from hexbytes import HexBytes from hexbytes import HexBytes
from unittest.mock import Mock from unittest.mock import Mock
@ -10,7 +8,7 @@ from nucypher.blockchain.economics import EconomicsFactory
from nucypher.blockchain.eth.agents import WorkLockAgent, StakingEscrowAgent, NucypherTokenAgent, PolicyManagerAgent from nucypher.blockchain.eth.agents import WorkLockAgent, StakingEscrowAgent, NucypherTokenAgent, PolicyManagerAgent
from nucypher.blockchain.eth.constants import NULL_ADDRESS from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory
from nucypher.utilities.sandbox.constants import MOCK_PROVIDER_URI from tests.utils.constants import MOCK_PROVIDER_URI
MOCK_TESTERCHAIN = BlockchainInterfaceFactory.get_or_create_interface(provider_uri=MOCK_PROVIDER_URI) MOCK_TESTERCHAIN = BlockchainInterfaceFactory.get_or_create_interface(provider_uri=MOCK_PROVIDER_URI)
CURRENT_BLOCK = MOCK_TESTERCHAIN.w3.eth.getBlock(block_identifier='latest') CURRENT_BLOCK = MOCK_TESTERCHAIN.w3.eth.getBlock(block_identifier='latest')

View File

@ -3,7 +3,6 @@ import json
from typing import Union from typing import Union
from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME from nucypher.blockchain.eth.constants import PREALLOCATION_ESCROW_CONTRACT_NAME
from nucypher.blockchain.eth.interfaces import BlockchainInterfaceFactory
from nucypher.blockchain.eth.networks import NetworksInventory from nucypher.blockchain.eth.networks import NetworksInventory
from nucypher.blockchain.eth.registry import ( from nucypher.blockchain.eth.registry import (
CanonicalRegistrySource, CanonicalRegistrySource,
@ -11,8 +10,8 @@ from nucypher.blockchain.eth.registry import (
IndividualAllocationRegistry, IndividualAllocationRegistry,
RegistrySourceManager RegistrySourceManager
) )
from nucypher.utilities.sandbox.blockchain import TesterBlockchain from tests.utils.blockchain import TesterBlockchain
from nucypher.utilities.sandbox.constants import TEMPORARY_DOMAIN, MOCK_PROVIDER_URI from tests.utils.constants import TEMPORARY_DOMAIN, MOCK_PROVIDER_URI
def make_mock_registry_source_manager(blockchain, test_registry, mock_backend: bool = False): def make_mock_registry_source_manager(blockchain, test_registry, mock_backend: bool = False):

View File

@ -3,13 +3,12 @@ import pytest
import time import time
import pytest_twisted as pt import pytest_twisted as pt
import requests
from flask import Response from flask import Response
from twisted.internet import threads from twisted.internet import threads
from nucypher.network.middleware import NucypherMiddlewareClient, RestMiddleware from nucypher.network.middleware import NucypherMiddlewareClient, RestMiddleware
from nucypher.network.trackers import AvailabilityTracker from nucypher.network.trackers import AvailabilityTracker
from nucypher.utilities.sandbox.ursula import start_pytest_ursula_services from tests.utils.ursula import start_pytest_ursula_services
@pt.inlineCallbacks @pt.inlineCallbacks

View File

@ -1,18 +1,15 @@
import datetime import datetime
import maya import maya
import pytest import pytest
import io
import os import os
import requests import requests
from twisted.internet import threads from twisted.internet import threads
import pytest_twisted import pytest_twisted
from werkzeug.exceptions import RequestEntityTooLarge
from nucypher.network.nodes import Learner
from nucypher.policy.collections import TreasureMap from nucypher.policy.collections import TreasureMap
from nucypher.policy.policies import Policy from nucypher.policy.policies import Policy
from nucypher.utilities.sandbox.middleware import NodeIsDownMiddleware, EvilMiddleWare from tests.utils.middleware import NodeIsDownMiddleware, EvilMiddleWare
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
from bytestring_splitter import BytestringSplittingError from bytestring_splitter import BytestringSplittingError
from functools import partial from functools import partial

View File

@ -25,8 +25,8 @@ from nucypher.crypto.api import keccak_digest
from nucypher.crypto.powers import SigningPower from nucypher.crypto.powers import SigningPower
from nucypher.network.nicknames import nickname_from_seed from nucypher.network.nicknames import nickname_from_seed
from nucypher.network.nodes import FleetStateTracker from nucypher.network.nodes import FleetStateTracker
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from tests.utils.constants import INSECURE_DEVELOPMENT_PASSWORD
from nucypher.utilities.sandbox.middleware import MockRestMiddleware from tests.utils.middleware import MockRestMiddleware
@pytest.mark.slow() @pytest.mark.slow()

View File

@ -21,7 +21,7 @@ from cryptography.hazmat.primitives import serialization
from twisted.internet import threads from twisted.internet import threads
from nucypher.characters.lawful import Ursula from nucypher.characters.lawful import Ursula
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
def test_alice_enacts_policies_in_policy_group_via_rest(enacted_federated_policy): def test_alice_enacts_policies_in_policy_group_via_rest(enacted_federated_policy):

View File

@ -20,7 +20,7 @@ import pytest
import pytest_twisted as pt import pytest_twisted as pt
from twisted.internet.threads import deferToThread from twisted.internet.threads import deferToThread
from nucypher.utilities.sandbox.ursula import make_federated_ursulas from tests.utils.ursula import make_federated_ursulas
@pt.inlineCallbacks @pt.inlineCallbacks

View File

@ -35,7 +35,7 @@ from nucypher.blockchain.eth.token import NU
from nucypher.blockchain.eth.utils import epoch_to_period from nucypher.blockchain.eth.utils import epoch_to_period
from nucypher.config.constants import BASE_DIR from nucypher.config.constants import BASE_DIR
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.constants import ( from tests.utils.constants import (
NUMBER_OF_ETH_TEST_ACCOUNTS, NUMBER_OF_ETH_TEST_ACCOUNTS,
NUMBER_OF_STAKERS_IN_BLOCKCHAIN_TESTS, NUMBER_OF_STAKERS_IN_BLOCKCHAIN_TESTS,
NUMBER_OF_URSULAS_IN_BLOCKCHAIN_TESTS, NUMBER_OF_URSULAS_IN_BLOCKCHAIN_TESTS,

View File

@ -22,7 +22,7 @@ import socket
from bytestring_splitter import VariableLengthBytestring from bytestring_splitter import VariableLengthBytestring
from nucypher.characters.lawful import Ursula from nucypher.characters.lawful import Ursula
from nucypher.network.middleware import RestMiddleware, NucypherMiddlewareClient from nucypher.network.middleware import RestMiddleware, NucypherMiddlewareClient
from nucypher.utilities.sandbox.constants import MOCK_KNOWN_URSULAS_CACHE from tests.utils.constants import MOCK_KNOWN_URSULAS_CACHE
from constant_sorrow.constants import CERTIFICATE_NOT_SAVED from constant_sorrow.constants import CERTIFICATE_NOT_SAVED
from flask import Response from flask import Response
@ -160,7 +160,6 @@ class NodeIsDownMiddleware(MockRestMiddleware):
self.client.ports_that_are_down = set(MOCK_KNOWN_URSULAS_CACHE) self.client.ports_that_are_down = set(MOCK_KNOWN_URSULAS_CACHE)
class EvilMiddleWare(MockRestMiddleware): class EvilMiddleWare(MockRestMiddleware):
""" """
Middleware for assholes. Middleware for assholes.
@ -180,4 +179,4 @@ class EvilMiddleWare(MockRestMiddleware):
response = self.client.post(node_or_sprout=node, response = self.client.post(node_or_sprout=node,
path=path, path=path,
data=data) data=data)
return response return response

View File

@ -19,18 +19,15 @@ from cryptography.x509 import Certificate
from typing import Set, List, Iterable, Optional from typing import Set, List, Iterable, Optional
from nucypher.blockchain.eth.actors import Staker from nucypher.blockchain.eth.actors import Staker
from nucypher.blockchain.eth.agents import StakingEscrowAgent
from nucypher.blockchain.eth.interfaces import BlockchainInterface from nucypher.blockchain.eth.interfaces import BlockchainInterface
from nucypher.blockchain.eth.registry import BaseContractRegistry
from nucypher.blockchain.eth.token import WorkTracker
from nucypher.characters.lawful import Ursula from nucypher.characters.lawful import Ursula
from nucypher.config.characters import UrsulaConfiguration from nucypher.config.characters import UrsulaConfiguration
from nucypher.crypto.powers import TransactingPower from tests.utils.constants import (
from nucypher.utilities.sandbox.constants import (
MOCK_KNOWN_URSULAS_CACHE, MOCK_KNOWN_URSULAS_CACHE,
MOCK_URSULA_STARTING_PORT, MOCK_URSULA_STARTING_PORT,
NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK, NUMBER_OF_URSULAS_IN_DEVELOPMENT_NETWORK,
MOCK_URSULA_DB_FILEPATH, INSECURE_DEVELOPMENT_PASSWORD) MOCK_URSULA_DB_FILEPATH
)
def make_federated_ursulas(ursula_config: UrsulaConfiguration, def make_federated_ursulas(ursula_config: UrsulaConfiguration,
@ -46,14 +43,10 @@ def make_federated_ursulas(ursula_config: UrsulaConfiguration,
federated_ursulas = set() federated_ursulas = set()
for port in range(starting_port, starting_port+quantity): for port in range(starting_port, starting_port+quantity):
ursula = ursula_config.produce(rest_port=port + 100, ursula = ursula_config.produce(rest_port=port + 100, db_filepath=MOCK_URSULA_DB_FILEPATH, **ursula_overrides)
db_filepath=MOCK_URSULA_DB_FILEPATH,
**ursula_overrides)
federated_ursulas.add(ursula) federated_ursulas.add(ursula)
# Store this Ursula in our global testing cache. # Store this Ursula in our global testing cache.
port = ursula.rest_interface.port port = ursula.rest_interface.port
MOCK_KNOWN_URSULAS_CACHE[port] = ursula MOCK_KNOWN_URSULAS_CACHE[port] = ursula