Exemplo n.º 1
0
 def new_ms(filename):
     ms = MonitoringService(
         web3=Web3Mock(),
         private_key=server_private_key,
         contracts=contracts,
         db_filename=os.path.join(tmpdir, filename),
     )
     msc = Mock()
     ms.context.monitoring_service_contract = msc
     ms.monitor_mock = msc.functions.monitor.return_value.transact  # type: ignore
     ms.monitor_mock.return_value = bytes(0)  # type: ignore
     return ms
Exemplo n.º 2
0
 def new_ms(filename):
     ms = MonitoringService(
         web3=Web3Mock(),
         private_key=server_private_key,
         contracts=contracts,
         db_filename=os.path.join(tmpdir, filename),
         poll_interval=0,
         required_confirmations=BlockTimeout(0),
         sync_start_block=BlockNumber(0),
     )
     msc = Mock()
     ms.context.monitoring_service_contract = msc
     ms.monitor_mock = msc.functions.monitor.return_value.transact
     ms.monitor_mock.return_value = bytes(0)
     return ms
Exemplo n.º 3
0
 def new_ms(filename):
     ms = MonitoringService(
         web3=web3,
         contract_manager=contracts_manager,
         private_key=server_private_key,
         registry_address=token_network_registry_contract.address,
         monitor_contract_address=monitoring_service_contract.address,
         db_filename=os.path.join(tmpdir, filename),
         user_deposit_contract_address=user_deposit_contract.address,
     )
     ms.bcl = MockBlockchainListener(events)  # type: ignore
     msc = Mock()
     ms.context.monitoring_service_contract = msc
     ms.monitor_mock = msc.functions.monitor.return_value.transact  # type:ignore
     ms.monitor_mock.return_value = bytes(0)  # type:ignore
     return ms
Exemplo n.º 4
0
 def new_ms(filename):
     ms = MonitoringService(
         web3=web3,
         private_key=server_private_key,
         contracts={
             CONTRACT_TOKEN_NETWORK_REGISTRY:
             token_network_registry_contract,
             CONTRACT_MONITORING_SERVICE: monitoring_service_contract,
             CONTRACT_USER_DEPOSIT: user_deposit_contract,
         },
         db_filename=os.path.join(tmpdir, filename),
     )
     ms.bcl = MockBlockchainListener(events)  # type: ignore
     msc = Mock()
     ms.context.monitoring_service_contract = msc
     ms.monitor_mock = msc.functions.monitor.return_value.transact  # type: ignore
     ms.monitor_mock.return_value = bytes(0)  # type: ignore
     return ms