def test_mk_args_negative_gas(self): """ Tests negative gas case provided as string. The value should not be included. """ config = TestFile.get_config_mock(4000000000, '-8') try: mk_args(config) except ValueError: # Expected pass
def test_mk_args_string_gas(self): """ Tests positive gas case where gas is provided as a string. """ gas_price_wei = 4000000000 config = TestFile.get_config_mock(gas_price_wei, '7') result = mk_args(config) self.assertEqual(gas_price_wei, result['gasPrice']) self.assertEqual('account', result['from']) self.assertEqual(7, result['gas'])
def test_mk_args_positive_gas(self): """ Tests positive gas case. """ gas_price_wei = 4000000000 config = TestFile.get_config_mock(gas_price_wei, 7) result = mk_args(config) self.assertEqual(gas_price_wei, result['gasPrice']) self.assertEqual('account', result['from']) self.assertEqual(7, result['gas'])
def test_mk_args_none_gas(self): """ If no gas is provided, the arguments do not contain the gas record. """ gas_price_wei = 4000000000 config = TestFile.get_config_mock(gas_price_wei, None) result = mk_args(config) self.assertEqual(gas_price_wei, result['gasPrice']) self.assertEqual('account', result['from']) self.assertTrue('gas' not in result)
def test_mk_args_zero_gas(self, method_call_mock): """ Tests zero gas case. """ gas_price_wei = 4000000000 config = TestFile.get_config_mock(gas_price_wei, 0) result = mk_args(config) self.assertEqual(gas_price_wei, result['gasPrice']) self.assertEqual('account', result['from']) self.assertEqual(0, result['gas'])
def test_send_signed_transaction_remote_signing(self): """ Tests the case when the transaction is not signed locally (when the private key is not provided). """ transaction = SimpleTransactionMock() config = TestFile.get_config_mock(4000000000, 0) result = send_signed_transaction(config, transaction) self.assertFalse(result.is_signed) self.assertIsNone(config.web3_client.eth.account.signed_private_key) self.assertIsNone(result.build_args) self.assertEqual(mk_args(config), result.transact_args)