Skip to content

Commit 08a885b

Browse files
committed
test coverage
1 parent cc76ef4 commit 08a885b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

chia/_tests/wallet/rpc/test_wallet_rpc.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import logging
88
import random
9+
import re
910
from collections.abc import AsyncIterator
1011
from operator import attrgetter
1112
from typing import Any, Optional
@@ -1270,6 +1271,45 @@ async def test_cat_endpoints(wallet_environments: WalletTestFramework, wallet_ty
12701271
),
12711272
)
12721273

1274+
# Test some validation errors
1275+
with pytest.raises(
1276+
ValueError,
1277+
match=re.escape('Must specify "additions" or "amount"+"inner_address"+"memos", but not both.'),
1278+
):
1279+
await env_0.rpc_client.cat_spend(
1280+
CATSpend(
1281+
wallet_id=cat_0_id,
1282+
amount=uint64(4),
1283+
inner_address=addr_1,
1284+
memos=["the cat memo"],
1285+
additions=[],
1286+
),
1287+
tx_config=wallet_environments.tx_config,
1288+
)
1289+
1290+
with pytest.raises(ValueError, match=re.escape('Must specify "amount" and "inner_address" together.')):
1291+
await env_0.rpc_client.cat_spend(
1292+
CATSpend(
1293+
wallet_id=cat_0_id,
1294+
amount=uint64(4),
1295+
inner_address=None,
1296+
),
1297+
tx_config=wallet_environments.tx_config,
1298+
)
1299+
1300+
with pytest.raises(
1301+
ValueError,
1302+
match=re.escape('Must specify \\"extra_delta\\", \\"tail_reveal\\" and \\"tail_solution\\" together.'),
1303+
):
1304+
await env_0.rpc_client.cat_spend(
1305+
CATSpend(
1306+
wallet_id=cat_0_id,
1307+
additions=[],
1308+
extra_delta="1",
1309+
),
1310+
tx_config=wallet_environments.tx_config,
1311+
)
1312+
12731313
tx_res = await env_0.rpc_client.cat_spend(
12741314
CATSpend(
12751315
wallet_id=cat_0_id,

0 commit comments

Comments
 (0)