Exemplo n.º 1
0
 def test_transactions_pool_get_transaction(self):
     wallet = Wallet()
     output = {wallet.address: 10}
     input = {'address': wallet.address}
     uuid = Transaction.generate_uuid()
     initial_transaction = Transaction(uuid=uuid,
                                       input=input,
                                       output=output)
     address = initial_transaction.input.get('address')
     self.assertNotIn(initial_transaction.uuid,
                      self.transactions_pool.pool.keys())
     self.transactions_pool.add_transaction(initial_transaction)
     transaction = self.transactions_pool.get_transaction(address)
     self.assertEqual(transaction.uuid, initial_transaction.uuid)
Exemplo n.º 2
0
 def test_transaction_generate_uuid(self):
     id = Transaction.generate_uuid()
     self.assertTrue(re.match(r'^[0-9]{,39}$', str(id)))
     self.assertIsInstance(uuid.UUID(int=id), uuid.UUID)