Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_amount_changer(self):
logger.info("test_amount_changer")
logger.setDebug()
logger.debug(10000000000000000000*100000000000000000000 + 1000)
num = int(3121092321831273291731287318721973219)
amnt = amount.int2amount(num, 2)
logger.debug(amnt)
re_num = amount.amount2int(amnt)
self.assertEqual(num,re_num)
def test_stateless_validator_signature_ng(self):
logger.debug("test_stateless_validator_signature_ng")
create_ac = Command.CreateAccount(
account_name = "rihito",
domain_id = "light.wing",
main_pubkey = self.keypair.public_key
)
payload = Transaction.Payload(
commands = [
Command(create_account = create_ac)
],
creator_account_id = self.creator,
tx_counter = self.tx_counter,
created_time = crypto.now()
)
payload2 = Transaction.Payload(
commands = [
def setUp(self):
logger.setDebug()
logger.debug("PrimitiveTest")
def account_asset(self):
logger.debug("Response.account_asset")
if self.has_account_asset():
return self.response.payload.account_assets_response.account_asset
else:
raise NotAccountAssetResponseException
def set_connection(self,connection):
"""
Set connection used to connect iroha
Args:
connection ( `Connection` ) : connection used to connect iroha
"""
logger.debug("Query.set_counnection")
self.connection = connection
def create_tx(self):
"""
Create Transaction
Returns:
`Transaction`: created transaction with added signatory, account_id, time stamp, and connection
"""
logger.debug("Creator.create_tx")
retx = Transaction()
if self.connection:
retx.set_connection(self.connection)
if self.signatories:
retx.add_key_pairs(self.signatories)
if self.creator_account_id:
retx.set_creator_account_id(self.creator_account_id)
# TODO It has not deceided yet
retx.set_tx_counter(0)
retx.time_stamp()
return retx
def sign(self,tx):
logger.debug("Signatories.sign")
payload = tx.payload
for signatory in self.signatories:
if not [ signature for signature in tx.signatures if signature.pubkey == signatory.public_key ]:
tx.signatures.extend([
Signature(
pubkey = signatory.public_key,
signature = crypto.sign(signatory, crypto.sign_hash(payload))
)
def set_creator_account_id(self,creator_account_id):
"""
Set creator of this query.
Args:
creator_account_id (str) : it is creator's account id of query
"""
logger.debug("Query.set_creator_account_id")
self.query.payload.creator_account_id = creator_account_id
def has_transactions(self):
logger.debug("Response.has_transactions")
return self.response.payload.HasField("transactions_response")
def has_account_asset(self):
logger.debug("Response.has_account_asset")
return self.response.payload.HasField("account_assets_response")