示例#1
0
    def test_balancing_keys_are_accessible_via_attributes(
            self, minimal_definition_dict, token_info_path):
        """The keys 'balance_min' and `balance_fund` are accessible via attributes.

        The accessor attributes are:

            * min_balance -> balance_min key
            * max_funding -> balance_fund key
        """
        minimal_definition_dict["token"]["balance_min"] = 66
        minimal_definition_dict["token"]["balance_fund"] = 99

        config = TokenConfig(minimal_definition_dict, token_info_path)
        assert config.min_balance == 66
        assert config.max_funding == 99
示例#2
0
 def test_properties_correctly_map_to_property_on_token_config(
     self,
     m_name,
     m_symbol,
     m_decimals,
     prop,
     runner,
     tmp_path,
     token_info_path,
     minimal_definition_dict,
 ):
     mocked_properties = {"name": m_name, "symbol": m_symbol, "decimals": m_decimals}
     runner.definition.token = TokenConfig(minimal_definition_dict, token_info_path)
     token = Token(runner, tmp_path)
     getattr(token, prop)
     assert len(mocked_properties[prop].mock_calls) == 1
示例#3
0
 def test_symbol_property_uses_token_id_to_generate_symbol_if_not_given_in_config(
         self, minimal_yaml_dict, token_info_path):
     """We generate a symbol if none is given, using the token id."""
     config = TokenConfig(minimal_yaml_dict, token_info_path)
     assert config.symbol == f"T{config._token_id!s:.3}"
示例#4
0
 def test_passing_mutual_exclusive_keys_raises_configuration_error(
         self, minimal_yaml_dict, token_info_path):
     minimal_yaml_dict["token"]["reuse"] = True
     minimal_yaml_dict["token"]["address"] = "some_address"
     with pytest.raises(TokenConfigurationError):
         TokenConfig(minimal_yaml_dict, token_info_path)
示例#5
0
 def test_is_subclass_of_config_mapping(self, minimal_yaml_dict,
                                        token_info_path):
     """The class is a subclass of :class:`ConfigMapping`."""
     assert isinstance(TokenConfig(minimal_yaml_dict, token_info_path),
                       ConfigMapping)