Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
logger.setDebug()
logger.info("CreatorTest")
def test_random(self):
a = random.uuid(10)
self.assertTrue(len(a),10)
b = random.uuid(53)
self.assertTrue(len(b),53)
logger.debug(a)
logger.debug(b)
def setUp(self):
logger.setInfo()
logger.info("RequestTest")
self.keypair = crypto.create_key_pair()
def add_command(self,cmd):
"""
Add Command to this transaction
Args:
cmd( `CreateAccount`,`AddSignatory`,`RemoveSignatory`,`CreateDomain`,`CreateAsset`,
`AddAssetQuantity`,`SetAccountQuorum` or `TransferAsset` ): command of protobuf structre.
"""
logger.debug("add_command")
self.tx.payload.commands.extend(
[helper_command.wrap_cmd(cmd)]
)
def __init__(self):
logger.debug("Create Query Construct")
self.query = QuerySchema(
payload = QuerySchema.Payload(
created_time = crypto.now()
)
# TODO query has signature
)
self.signatories = Signatories()
def amount2int(amount):
"""
Translater Protobuf Amount -> python int type
Args:
amount ( `Amount` ) : protobuf amount type ( don't care precision )
Returns:
int: int value equal to arg amount.
"""
logger.debug("amount2int")
res = int(0)
res += int(amount.value.first)
res *= UINT64_NUMBER
logger.debug(res)
res += int(amount.value.second)
res *= UINT64_NUMBER
logger.debug(res)
res += int(amount.value.third)
res *= UINT64_NUMBER
logger.debug(res)
res += int(amount.value.fourth)
return res
def create_query(self):
"""
Create Query
Returns:
`Query`: created query with added account_id, tima stamp, and connection.
"""
logger.debug("Creator.create_query")
retq = Query()
if self.connection:
retq.set_connection(self.connection)
if self.creator_account_id:
retq.set_creator_account_id(self.creator_account_id)
# TODO It has not deceided yet
retq.set_query_counter(0)
retq.time_stamp()
return retq
def __init__(self,query_response):
logger.debug("Create Response Construct")
self.response = query_response