functional_tests: add cc_allow_styling tests

This commit is contained in:
Crypto City 2023-02-09 19:21:36 +00:00
parent f96628d988
commit 1a68d7e1ad
2 changed files with 30 additions and 1 deletions

View File

@ -7885,6 +7885,35 @@ script {
self.wallet[1].cc_buy_land(city_ox + 1200, city_oy + 60, city_ox + 1200 + 16 - 1, city_oy + 60 + 16 - 1, city = 1)
self.generate_blocks('TF1MMBg4zx18SnZC6oswCRB7DzdVeUKce5NdCMSWUHNY4wNvNhzmFj4WqZY2bFj8R1REAWR3qAH5zD7sjXyHz3tVayzHSswqymx', 1)
print("Testing styling list")
# lists start out empty
res = daemon.cc_get_city(0)
assert 'allow_styling' not in res or len(res.allow_styling) == 0
res = daemon.cc_get_city(1)
assert 'allow_styling' not in res or len(res.allow_styling) == 0
# only the mayor may modify the list
res = self.wallet[1].cc_get_info()
account_id = res.account_id
self.assert_exception(lambda: self.wallet[1].cc_allow_styling([account_id], 1, True))
# we can't remove someone who's not in the list
self.assert_exception(lambda: self.wallet[2].cc_allow_styling([account_id], 1, False))
self.wallet[2].cc_allow_styling([account_id], 1, True, 0)
self.generate_blocks('TF1MMBg4zx18SnZC6oswCRB7DzdVeUKce5NdCMSWUHNY4wNvNhzmFj4WqZY2bFj8R1REAWR3qAH5zD7sjXyHz3tVayzHSswqymx', 1)
res = daemon.cc_get_city(1)
assert res.allow_styling == [account_id]
# we can't add someone who's already in the list
self.assert_exception(lambda: self.wallet[2].cc_allow_styling([account_id], 1, True))
# we can remove from the list
self.wallet[2].cc_allow_styling([account_id], 1, False)
self.generate_blocks('TF1MMBg4zx18SnZC6oswCRB7DzdVeUKce5NdCMSWUHNY4wNvNhzmFj4WqZY2bFj8R1REAWR3qAH5zD7sjXyHz3tVayzHSswqymx', 1)
print('Testing fishing in a different city\'s medium fishing grounds')
# build a fishery, needs to be partway in water

View File

@ -2050,7 +2050,7 @@ class Wallet(object):
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(cc_allow_settlers)
return self.rpc.send_json_rpc_request(cc_allow_styling)
def cc_allow_settlers(self, accounts, city, allow, last_allow_settlers_height, priority = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
cc_allow_settlers = {