def test_equal(self): op1 = ManageData("a", "b") op2 = ManageData("a", "b") op3 = ManageData("A", "B") op4 = "BAD TYEE" assert op1 == op2 != op3 != op4
def test_to_xdr_obj_with_invalid_value_raise(self, name, value): source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" with pytest.raises( ValueError, match=r"Data and value should be <= 64 bytes \(ascii encoded\)." ): ManageData(name, value, source)
def test_from_xdr_obj(self, name, value): source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" origin_xdr_obj = ManageData(name, value, source).to_xdr_object() op = Operation.from_xdr_object(origin_xdr_obj) assert isinstance(op, ManageData) assert op.source == source assert op.data_name == name if isinstance(value, str): value = value.encode() assert op.data_value == value
def test_to_xdr_obj(self, name, value, xdr): source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV" op = ManageData(name, value, source) assert op.to_xdr_object().to_xdr() == xdr