def test_to_xdr_obj_without_source(self): destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" starting_balance = "1000.00" op = CreateAccount(destination, starting_balance) assert (op.to_xdr_object().to_xdr() == "AAAAAAAAAAAAAAAAiZsoQO1WNsVt3F8Usjl" "1958bojiNJpTkxW7N3clg5e8AAAACVAvkAA==")
def test_to_xdr_obj(self): source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" starting_balance = "1000.00" op = CreateAccount(destination, starting_balance, source) assert ( op.to_xdr_object().to_xdr() == "AAAAAQAAAADX7fRsY6KTqIc8EIDyr8M9gxGPW6ODnZoZDgo6l1ymwwAAA" "AAAAAAAiZsoQO1WNsVt3F8Usjl1958bojiNJpTkxW7N3clg5e8AAAACVAvkAA==")
def test_get_source_no_exist_from_xdr_obj(self): # BAD TEST destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" starting_balance = "1000.00" origin_op = CreateAccount(destination, starting_balance) origin_xdr_obj = origin_op.to_xdr_object() op = Operation.from_xdr_object(origin_xdr_obj) assert op.source == None assert op.starting_balance == "1000" assert op.destination == destination
def test_get_source_exist_from_xdr_obj(self): # BAD TEST source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" starting_balance = "1000.00" origin_op = CreateAccount(destination, starting_balance, source) origin_xdr_obj = origin_op.to_xdr_object() op = Operation.from_xdr_object(origin_xdr_obj) assert op.source == source assert op.starting_balance == "1000" assert op.destination == destination
def test_get_muxed_account_source_exist_from_xdr_obj(self): # BAD TEST source = "MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY" destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" starting_balance = "1000.00" origin_op = CreateAccount(destination, starting_balance, source) origin_xdr_obj = origin_op.to_xdr_object() op = Operation.from_xdr_object(origin_xdr_obj) assert op.source == source assert op.starting_balance == "1000" assert op.destination == destination
def test_get_source_muxed_from_xdr_obj(self): # BAD TEST destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ" source = "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB" source2 = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" starting_balance = "1000.00" origin_op = CreateAccount(destination, starting_balance, source) origin_xdr_obj = origin_op.to_xdr_object() op = Operation.from_xdr_object(origin_xdr_obj) assert op.to_xdr_object().to_xdr() == origin_xdr_obj.to_xdr() assert op.source == source assert ( op._source_muxed.to_xdr() == Keypair.from_public_key(source).xdr_muxed_account().to_xdr() ) op.source = source2 assert op.source == source2 assert op._source_muxed is None