Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
habanoz committed Sep 25, 2019
1 parent 95adc64 commit b01e232
Showing 1 changed file with 5 additions and 52 deletions.
57 changes: 5 additions & 52 deletions src/config/test_BakingYamlConfParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_validate_pymnt_alias(self):
data_no_founders = """
version : 1.0
baking_address : tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj
payment_address : ktPay
payment_address : tzPay
owners_map : {'KT2Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj':0.5,'KT3Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj':0.5}
service_fee : 4.5
min_delegation_amt : 100
Expand All @@ -104,7 +104,7 @@ def test_validate_pymnt_alias(self):
managers_map = {'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj',
'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'}

contr_dict_by_alias = {'ktPay': 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'}
contr_dict_by_alias = {'kt': 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj','tzPay':'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'}
addr_dict_by_pkh = {
"tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False,
"alias": "tz1", "sk": True,
Expand All @@ -125,62 +125,15 @@ def test_validate_pymnt_alias(self):
cnf_prsr.validate()

self.assertEqual(cnf_prsr.get_conf_obj_attr('baking_address'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'ktPay')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'tzPay')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_manager'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.KTALS)
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.TZALS)

self.assertEqual(cnf_prsr.get_conf_obj_attr('founders_map'), dict())
self.assertEqual(cnf_prsr.get_conf_obj_attr('specials_map'), dict())
self.assertEqual(cnf_prsr.get_conf_obj_attr('supporters_set'), set())

self.assertEqual(100, cnf_prsr.get_conf_obj_attr('min_delegation_amt'))

def test_validate_empty(self):
data_fine = """
version : 1.0
baking_address : tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj
payment_address : KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj
service_fee : 4.5
founders_map : {}
owners_map : {}
specials_map : {}
supporters_set : {}
min_delegation_amt : 0
"""


managers = {'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj',
'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj': 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj'}

contr_dict_by_alias = {}
addr_dict_by_pkh = {
"tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False,
"alias": "main1", "sk": True, "revealed" : True,
"manager": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj"},

"KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj": {"pkh": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj", "originated": False,
"alias": "ktPay", "sk": True, "revealed":True,
"manager": "tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj"}
}

wallet_client_manager = WalletClientManager(client_path=None, addr_dict_by_pkh=addr_dict_by_pkh,
contr_dict_by_alias=contr_dict_by_alias, managers=managers)

mirror_selector = TzScanMirrorSelector(network)
mirror_selector.initialize()
block_api = TzScanBlockApiImpl(network, mirror_selector)
cnf_prsr = BakingYamlConfParser(data_fine, wallet_client_manager, provider_factory=None,
network_config=network, node_url=mainnet_public_node_url, block_api=block_api)


cnf_prsr.parse()
cnf_prsr.validate()

self.assertEqual(cnf_prsr.get_conf_obj_attr('baking_address'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('payment_address'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_pkh'), 'KT1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_manager'), 'tz1Z1tMai15JWUWeN2PKL9faXXVPMuWamzJj')
self.assertEqual(cnf_prsr.get_conf_obj_attr('__payment_address_type'), AddrType.KT)
self.assertEqual(0, cnf_prsr.get_conf_obj_attr('min_delegation_amt'))
self.assertEqual(cnf_prsr.get_conf_obj_attr('supporters_set'), set())

0 comments on commit b01e232

Please sign in to comment.