Fixed tests after merge

pull/261/head
szotov 2018-04-30 19:07:24 +03:00
parent 005fb5b773
commit 889e6c0176
4 changed files with 13 additions and 18 deletions

View File

@ -23,6 +23,7 @@ def test_dispatcher(web3, chain):
contract2_bad_lib, _ = chain.provider.deploy_contract('ContractV2Bad')
dispatcher, _ = chain.provider.deploy_contract('Dispatcher', contract1_lib.address)
rollbacks = dispatcher.events.RolledBack.createFilter(fromBlock=0)
upgrades = dispatcher.events.Upgraded.createFilter(fromBlock=0)
assert dispatcher.functions.target().call() == contract1_lib.address
@ -149,8 +150,6 @@ def test_dispatcher(web3, chain):
chain.wait_for_receipt(tx)
assert dispatcher.functions.target().call() == contract2_lib.address
rollbacks = dispatcher.events.RolledBack.createFilter(fromBlock=0)
# But can rollback
tx = dispatcher.functions.rollback().transact({'from': creator})
chain.wait_for_receipt(tx)
@ -164,7 +163,6 @@ def test_dispatcher(web3, chain):
assert contract_instance.functions.getStorageValue().call() == 5
events = rollbacks.get_all_entries()
assert 1 == len(events)
event_args = events[0]['args']
assert contract2_lib.address == event_args['from']
@ -225,7 +223,6 @@ def test_dispatcher(web3, chain):
assert contract_instance.functions.storageValueToCheck().call() == 2
events = upgrades.get_all_entries()
assert 4 == len(events)
event_args = events[2]['args']
assert contract1_lib.address == event_args['from']
@ -241,7 +238,6 @@ def test_dispatcher(web3, chain):
chain.wait_for_receipt(tx)
test_eventv2_log = contract_instance.events.EventV2.createFilter(fromBlock=0)
events = test_eventv2_log.get_all_entries()
assert 1 == len(events)
assert 22 == events[0]['args']['value']

View File

@ -276,23 +276,23 @@ def test_all(web3, chain, token, escrow, policy_manager):
# Create policies
policy_id_1 = os.urandom(20)
tx = policy_manager.functions.createPolicy(policy_id_1, 5, [ursula1, ursula2]).transact({'from': alice1, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
tx = policy_manager.functions.createPolicy(policy_id_1, 5, 44, [ursula1, ursula2]).transact({'from': alice1, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
chain.wait_for_receipt(tx)
policy_id_2 = os.urandom(20)
tx = policy_manager.functions.createPolicy(policy_id_2, 5, [ursula2, user_escrow_1.address]).transact({'from': alice1, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
tx = policy_manager.functions.createPolicy(policy_id_2, 5, 44, [ursula2, user_escrow_1.address]).transact({'from': alice1, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
chain.wait_for_receipt(tx)
policy_id_3 = os.urandom(20)
tx = policy_manager.functions.createPolicy(policy_id_3, 5, [ursula1, user_escrow_1.address]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
tx = policy_manager.functions.createPolicy(policy_id_3, 5, 44, [ursula1, user_escrow_1.address]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
chain.wait_for_receipt(tx)
policy_id_4 = os.urandom(20)
tx = policy_manager.functions.createPolicy(policy_id_4, 5, [ursula2, user_escrow_1.address]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
tx = policy_manager.functions.createPolicy(policy_id_4, 5, 44, [ursula2, user_escrow_1.address]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
chain.wait_for_receipt(tx)
policy_id_5 = os.urandom(20)
tx = policy_manager.functions.createPolicy(policy_id_5, 5, [ursula1, ursula2]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
tx = policy_manager.functions.createPolicy(policy_id_5, 5, 44, [ursula1, ursula2]).transact({'from': alice2, 'value': 2 * 1000 + 2 * 44, 'gas_price': 0})
chain.wait_for_receipt(tx)

View File

@ -533,8 +533,8 @@ def test_mining(web3, chain, token, escrow_contract):
chain.wait_for_receipt(tx)
tx = escrow.functions.mint().transact({'from': ursula2})
chain.wait_for_receipt(tx)
assert 1046 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0)).call()
assert 521 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0)).call()
assert 1046 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0).call())
assert 521 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0).call())
events = mining_log.get_all_entries()
assert 2 == len(events)
@ -584,8 +584,8 @@ def test_mining(web3, chain, token, escrow_contract):
# But Ursula(2) can't get reward because she did not confirm activity
tx = escrow.functions.mint().transact({'from': ursula2})
chain.wait_for_receipt(tx)
assert 1152 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0)).call()
assert 521 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0)).call()
assert 1152 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0).call())
assert 521 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0).call())
assert 3 == policy_manager.functions.getPeriodsLength(ursula1).call()
assert 1 == policy_manager.functions.getPeriodsLength(ursula2).call()
@ -617,8 +617,8 @@ def test_mining(web3, chain, token, escrow_contract):
chain.time_travel(hours=5)
tx = escrow.functions.mint().transact({'from': ursula2})
chain.wait_for_receipt(tx)
assert 1152 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0)).call()
assert 842 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0)).call()
assert 1152 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula1, 0).call())
assert 842 == web3.toInt(escrow.functions.getMinerInfo(VALUE_FIELD, ursula2, 0).call())
events = mining_log.get_all_entries()
assert 4 == len(events)

View File

@ -466,8 +466,7 @@ def test_refund(web3, chain, escrow, policy_manager):
chain.wait_for_receipt(tx)
assert 0 == web3.eth.getBalance(policy_manager.address)
assert client_balance == web3.eth.getBalance(client)
assert 1 == web3.toInt(
policy_manager.functions.getPolicyInfo(DISABLED_FIELD, policy_id, NULL_ADDR)).call()
assert 1 == web3.toInt(policy_manager.functions.getPolicyInfo(DISABLED_FIELD, policy_id, NULL_ADDR).call())
events = arrangement_refund_log.get_all_entries()
assert 2 == len(events)