Ejemplo n.º 1
0
 def test_transaction_outputs(self):
     u1 = Client()
     u2 = Client()
     outputs = [(u2.public_key, 5)]
     tx = Transaction(u1.public_key, u1.get_sk(), [], outputs, False)
     utxo_op = tx.get_outputs()
     self.assertEqual(len(outputs), 1)
     self.assertEqual(utxo_op[0].get_recipient_pk(), u2.public_key)
Ejemplo n.º 2
0
 def test_transaction_dumping(self):
     u1 = Client()
     u2 = Client()
     outputs = [(u2.public_key, 5)]
     tx = Transaction(u1.public_key, u1.get_sk(), [], outputs, False)
     dictionary = tx.to_dict()
     self.assertEqual(dictionary['witnesses_included'], False)
     self.assertEqual(dictionary['originator'], u1.public_key)
     self.assertEqual(dictionary['witnesses'], [])
     self.assertEqual(dictionary['ip_counter'], 0)
     self.assertEqual(dictionary['inputs'], [])
     self.assertEqual(dictionary['op_counter'], 1)
     self.assertEqual(dictionary['outputs'], tx.get_outputs())
     self.assertEqual(dictionary['time'], tx.get_timestamp())