Ejemplo n.º 1
0
    def __init__(self, is_me=True, federated_only=False, network_middleware=None, *args, **kwargs) -> None:

        policy_agent = kwargs.pop("policy_agent", None)
        checksum_address = kwargs.pop("checksum_address", None)
        Character.__init__(self,
                           is_me=is_me,
                           federated_only=federated_only,
                           checksum_address=checksum_address,
                           network_middleware=network_middleware,
                           *args, **kwargs)

        if is_me and not federated_only:  # TODO: 289
            PolicyAuthor.__init__(self, policy_agent=policy_agent, checksum_address=checksum_address)
Ejemplo n.º 2
0
    def __init__(self,
                 is_me=True,
                 federated_only=False,
                 network_middleware=None,
                 controller=True,
                 *args, **kwargs) -> None:

        _policy_agent = kwargs.pop("policy_agent", None)
        checksum_address = kwargs.pop("checksum_public_address", None)
        Character.__init__(self,
                           is_me=is_me,
                           federated_only=federated_only,
                           checksum_public_address=checksum_address,
                           network_middleware=network_middleware,
                           *args, **kwargs)

        if is_me and not federated_only:  # TODO: 289
            PolicyAuthor.__init__(self, checksum_address=checksum_address)

        if is_me and controller:
            self.controller = self._controller_class(alice=self)

        self.log = Logger(self.__class__.__name__)
        self.log.info(self.banner)
Ejemplo n.º 3
0
def test_create_policy_author(testerchain, three_agents):
    token_agent, miner_agent, policy_agent = three_agents
    _origin, ursula, alice, *everybody_else = testerchain.interface.w3.eth.accounts
    policy_author = PolicyAuthor(checksum_address=alice)
    assert policy_author.checksum_public_address == alice
Ejemplo n.º 4
0
def author(testerchain, three_agents):
    token_agent, miner_agent, policy_agent = three_agents
    token_agent.ether_airdrop(amount=100000 * constants.M)
    _origin, ursula, alice, *everybody_else = testerchain.interface.w3.eth.accounts
    author = PolicyAuthor(checksum_address=alice)
    return author
Ejemplo n.º 5
0
    def test_create_policy_author(self, chain, mock_policy_agent):
        _origin, ursula, alice, *everybody_else = chain.interface.w3.eth.accounts

        policy_author = PolicyAuthor(policy_agent=mock_policy_agent, address=alice)
        assert policy_author.address == alice
Ejemplo n.º 6
0
 def author(self, chain, mock_token_agent, mock_policy_agent):
     mock_token_agent.ether_airdrop(amount=100000 * mock_token_agent.M)
     _origin, ursula, alice, *everybody_else = chain.interface.w3.eth.accounts
     miner = PolicyAuthor(address=alice, policy_agent=mock_policy_agent)
     return miner
Ejemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     PolicyAuthor.__init__(self, address=self.address, *args, **kwargs)
Ejemplo n.º 8
0
def test_create_policy_author(testerchain, agency):
    _origin, ursula, alice, *everybody_else = testerchain.client.accounts
    policy_author = PolicyAuthor(checksum_address=alice,
                                 blockchain=testerchain)
    assert policy_author.checksum_address == alice
Ejemplo n.º 9
0
def author(testerchain, agency):
    _origin, ursula, alice, *everybody_else = testerchain.client.accounts
    author = PolicyAuthor(checksum_address=alice, blockchain=testerchain)
    return author
Ejemplo n.º 10
0
def author(testerchain, three_agents):
    token_agent, miner_agent, policy_agent = three_agents
    token_agent.ether_airdrop(amount=TESTING_ETH_AIRDROP_AMOUNT)
    _origin, ursula, alice, *everybody_else = testerchain.interface.w3.eth.accounts
    author = PolicyAuthor(checksum_address=alice)
    return author
Ejemplo n.º 11
0
def author(testerchain, three_agents):
    _origin, ursula, alice, *everybody_else = testerchain.interface.w3.eth.accounts
    author = PolicyAuthor(checksum_address=alice)
    return author