Skip to content

Commit bb84b71

Browse files
ishaanammurchandamus
authored andcommitted
add tests for no recipient and using send_max while inputs are specified
1 parent 49090ec commit bb84b71

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/functional/wallet_sendall.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,30 @@ def sendall_fails_on_missing_input(self):
240240
foreign_utxo["vout"]), self.wallet.sendall, recipients=[self.remainder_target],
241241
options={"inputs": [foreign_utxo]})
242242

243+
@cleanup
244+
def sendall_fails_on_no_address(self):
245+
self.log.info("Test sendall fails because no address is provided")
246+
self.add_utxos([19, 2])
247+
248+
assert_raises_rpc_error(
249+
-8,
250+
"Must provide at least one address without a specified amount" ,
251+
self.wallet.sendall,
252+
[]
253+
)
254+
255+
@cleanup
256+
def sendall_fails_on_specific_inputs_with_send_max(self):
257+
self.log.info("Test sendall fails because send_max is used while specific inputs are provided")
258+
self.add_utxos([15, 6])
259+
utxo = self.wallet.listunspent()[0]
260+
261+
assert_raises_rpc_error(-8,
262+
"Cannot combine send_max with specific inputs.",
263+
self.wallet.sendall,
264+
recipients=[self.remainder_target],
265+
options={"inputs": [utxo], "send_max": True})
266+
243267
def run_test(self):
244268
self.nodes[0].createwallet("activewallet")
245269
self.wallet = self.nodes[0].get_wallet_rpc("activewallet")
@@ -282,5 +306,11 @@ def run_test(self):
282306
# Fails for the right reasons on missing or previously spent UTXOs
283307
self.sendall_fails_on_missing_input()
284308

309+
# Sendall fails when no address is provided
310+
self.sendall_fails_on_no_address()
311+
312+
# Sendall fails when using send_max while specifying inputs
313+
self.sendall_fails_on_specific_inputs_with_send_max()
314+
285315
if __name__ == '__main__':
286316
SendallTest().main()

0 commit comments

Comments
 (0)