def test_to_xdr_obj(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     amount = "1000.0000000"
     asset = Asset("USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     op = Payment(destination, asset, amount, source)
     assert (
         op.to_xdr_object().to_xdr()
         == "AAAAAQAAAADX7fRsY6KTqIc8EIDyr8M9gxGPW6ODnZoZDgo6l1ymwwAAAAEAAAAAiZsoQO1WNsVt3F8Usjl1958bojiNJpTkxW7N3clg5e8AAAABVVNEAAAAAADNTrgPO19O0EsnYjSc333yWGLKEVxLyu1kfKjCKOz9ewAAAAJUC+QA"
     )
 def test_to_xdr_obj_with_invalid_amount_raise(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     amount = 1
     asset = Asset("USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     with pytest.raises(TypeError):
         Payment(destination, asset, amount, source)
 def test_to_xdr_obj_with_invalid_destination_raise(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZW"
     amount = "1000.0000000"
     asset = Asset("USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     with pytest.raises(ValueError):
         Payment(destination, asset, amount, source)
Beispiel #4
0
 def test_from_xdr_muxed(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     destination2 = "GBL3NR5XNBNFAYVQMZ7R6RMUKLMGRUHNIYDYMEUPANQV6OROQXSDZYHV"
     amount = "1000.0000000"
     asset = Asset("USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     origin_xdr_obj = Payment(destination, asset, amount, source).to_xdr_object()
     restore_op = Payment.from_xdr_object(origin_xdr_obj)
     assert restore_op.to_xdr_object().to_xdr() == origin_xdr_obj.to_xdr()
     assert (
         restore_op._destination_muxed.to_xdr()
         == Keypair.from_public_key(destination).xdr_muxed_account().to_xdr()
     )
     restore_op.destination = destination2
     assert restore_op._destination_muxed is None
     assert restore_op.destination == destination2
 def test_from_xdr_obj(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     amount = "1000.0000000"
     asset = Asset("USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     origin_xdr_obj = Payment(destination, asset, amount, source).to_xdr_object()
     op = Operation.from_xdr_object(origin_xdr_obj)
     assert isinstance(op, Payment)
     assert op.source == source
     assert op.destination == destination
     assert op.amount == "1000"
     assert op.asset == asset