mirror of https://github.com/nucypher/nucypher.git
[KMS-ETH]- PopulusConfig -> EthereumConfig: Prep for inter-codebase merge.
parent
82cafb3252
commit
a81c729c83
6
Pipfile
6
Pipfile
|
@ -1,20 +1,16 @@
|
|||
[[source]]
|
||||
|
||||
url = "https://pypi.python.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
|
||||
[packages]
|
||||
|
||||
pdbpp = "*"
|
||||
ipython = "*"
|
||||
populus = "*"
|
||||
cytoolz = "*"
|
||||
appdirs = "*"
|
||||
|
||||
eth-tester = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
pytest = "*"
|
||||
pdbpp = "*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from abc import ABC
|
||||
|
||||
from nkms_eth.config import PopulusConfig
|
||||
from nkms_eth.config import EthereumConfig
|
||||
|
||||
|
||||
class TheBlockchain(ABC):
|
||||
|
@ -22,10 +22,10 @@ class TheBlockchain(ABC):
|
|||
transient_chains = test_chains + ('testrpc', 'temp')
|
||||
public_chains = ('mainnet', 'ropsten')
|
||||
|
||||
class IsAlreadyRunning(Exception):
|
||||
class IsAlreadyRunning(RuntimeError):
|
||||
pass
|
||||
|
||||
def __init__(self, populus_config: PopulusConfig=None):
|
||||
def __init__(self, populus_config: EthereumConfig=None):
|
||||
"""
|
||||
Configures a populus project and connects to blockchain.network.
|
||||
Transaction timeouts specified measured in seconds.
|
||||
|
@ -41,7 +41,7 @@ class TheBlockchain(ABC):
|
|||
TheBlockchain.__instance = self
|
||||
|
||||
if populus_config is None:
|
||||
populus_config = PopulusConfig()
|
||||
populus_config = EthereumConfig()
|
||||
self._populus_config = populus_config
|
||||
self._project = populus_config.project
|
||||
|
||||
|
|
|
@ -72,14 +72,15 @@ class NuCypherMinerConfig:
|
|||
return self.__reward
|
||||
|
||||
|
||||
class PopulusConfig:
|
||||
__project_name = 'nucypher-kms'
|
||||
class EthereumConfig:
|
||||
__python_project_name = 'nucypher-kms'
|
||||
__default_solidity_dir = os.path.join() # TODO
|
||||
|
||||
def __init__(self, registrar_path=None):
|
||||
|
||||
# This config is persistent and is created in user's .local directory
|
||||
if registrar_path is None:
|
||||
registrar_path = join(appdirs.user_data_dir(self.__project_name), 'registrar.json')
|
||||
registrar_path = join(appdirs.user_data_dir(self.__python_project_name), 'registrar.json')
|
||||
self._registrar_path = registrar_path
|
||||
|
||||
# Populus project config
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
import pytest
|
||||
from web3 import Web3
|
||||
from web3.providers.eth_tester import EthereumTesterProvider
|
||||
|
||||
from nkms_eth.agents import NuCypherKMSTokenAgent, MinerAgent, PolicyAgent
|
||||
from nkms_eth.blockchain import TheBlockchain
|
||||
from nkms_eth.deployers import PolicyManagerDeployer
|
||||
from nkms_eth.utilities import TesterBlockchain, MockNuCypherKMSTokenDeployer, MockMinerEscrowDeployer, MockMinerAgent
|
||||
from eth_tester import EthereumTester
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def testerchain():
|
||||
chain = TesterBlockchain()
|
||||
tester = EthereumTester()
|
||||
test_provider = EthereumTesterProvider(ethereum_tester=tester)
|
||||
web3 = Web3(providers=test_provider)
|
||||
|
||||
yield chain
|
||||
del chain
|
||||
TheBlockchain._TheBlockchain__instance = None
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import os
|
||||
import random
|
||||
|
||||
import pytest
|
||||
|
||||
from nkms_eth.actors import Miner
|
||||
from nkms_eth.agents import MinerAgent
|
||||
from nkms_eth.utilities import spawn_miners
|
||||
|
||||
|
||||
def test_miner_locking_tokens(testerchain, mock_token_deployer, mock_miner_agent):
|
||||
|
|
Loading…
Reference in New Issue