|
| 1 | +import copy |
1 | 2 | from dataclasses import replace
|
2 | 3 | from test.pycardano.test_key import SK
|
3 | 4 | from test.pycardano.util import chain_context
|
@@ -129,30 +130,24 @@ def test_tx_builder_with_potential_inputs(chain_context):
|
129 | 130 |
|
130 | 131 | utxos = chain_context.utxos(sender)
|
131 | 132 |
|
132 |
| - tx_builder.potential_inputs.append(utxos[1]) |
| 133 | + tx_builder.potential_inputs.extend(utxos) |
133 | 134 |
|
134 |
| - tx_builder.add_output(TransactionOutput.from_primitive([sender, 500000])) |
| 135 | + for i in range(20): |
| 136 | + utxo = copy.deepcopy(utxos[0]) |
| 137 | + utxo.input.index = i + 100 |
| 138 | + tx_builder.potential_inputs.append(utxo) |
135 | 139 |
|
136 |
| - tx_body = tx_builder.build(change_address=sender_address) |
| 140 | + assert len(tx_builder.potential_inputs) > 1 |
137 | 141 |
|
138 |
| - expected = { |
139 |
| - 0: [[b"22222222222222222222222222222222", 1]], |
140 |
| - 1: [ |
141 |
| - # First output |
142 |
| - [sender_address.to_primitive(), 500000], |
143 |
| - # Second output as change |
144 |
| - [ |
145 |
| - sender_address.to_primitive(), |
146 |
| - [ |
147 |
| - 5332431, |
148 |
| - {b"1111111111111111111111111111": {b"Token1": 1, b"Token2": 2}}, |
149 |
| - ], |
150 |
| - ], |
151 |
| - ], |
152 |
| - 2: 167569, |
153 |
| - } |
| 142 | + tx_builder.add_output( |
| 143 | + TransactionOutput.from_primitive( |
| 144 | + [sender, [5000000, {b"1111111111111111111111111111": {b"Token1": 1}}]] |
| 145 | + ) |
| 146 | + ) |
154 | 147 |
|
155 |
| - assert expected == tx_body.to_primitive() |
| 148 | + tx_body = tx_builder.build(change_address=sender_address) |
| 149 | + |
| 150 | + assert len(tx_body.inputs) < len(tx_builder.potential_inputs) |
156 | 151 |
|
157 | 152 |
|
158 | 153 | def test_tx_builder_multi_asset(chain_context):
|
|
0 commit comments