-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chia plotnft CLI improvements * use CliRpcConnectionError * add check to show * fix typo * Update plotnft CLI to newer framework * Fix help cut-paste error * add test using new framework * some minor fixes * use click.Choice for pool/local option * some click options * Some more plotnft cli tests * drop test_pool_cmdline from mypy-exclusions * mypy fixes * several fixes * Add leave test * join tests * more join tests * missing await * Try setting config * use root_path from NeedsWalletRPC * linting * Some cleanup * Add claim tests * Improved tests * refactor some test code * Add inspect tests * Skip bad test for now * Add in change payout tests * quoting error * Add test for get_login_link * Add in a few negative tests for join * Few more tests * Experment with clirunner env overrides * put back chia_root into context dict * Some cleanup and one more test * maybe final test * some updates * some dedup and reorg of test code * run trusted and untrusted paramertization * make reuse puzhash stuff work * Add in required mock object for test_update_pool_config_new_config * rearrange code per review comment - limit use of NeedsWalletRPC to chia_command * Add in plotnft click parsing tests * added ability to pass in obj to runner invoke * Add in some more test cases * fix up create issues with config * Add in couple more test cases for error conditions * Minor code cleanup * Use long options for readability, minor code cleanup * Use config file for farmer rpc port * simplify code * Add testing for prompt cases * Add mocking for default_root_path * context cleanup * temp debugging output * patch the proper object * move some wallet fixtures into top level conftest and remove conftest import * merge to origin/main
- Loading branch information
Showing
10 changed files
with
1,745 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
from __future__ import annotations | ||
|
||
from chia._tests.cmds.test_cmd_framework import check_click_parsing | ||
from chia.cmds.cmd_classes import NeedsWalletRPC | ||
from chia.cmds.param_types import CliAddress | ||
from chia.cmds.plotnft import ( | ||
ChangePayoutInstructionsPlotNFTCMD, | ||
ClaimPlotNFTCMD, | ||
CreatePlotNFTCMD, | ||
GetLoginLinkCMD, | ||
InspectPlotNFTCMD, | ||
JoinPlotNFTCMD, | ||
LeavePlotNFTCMD, | ||
ShowPlotNFTCMD, | ||
) | ||
from chia.types.blockchain_format.sized_bytes import bytes32 | ||
from chia.util.bech32m import encode_puzzle_hash | ||
from chia.util.ints import uint64 | ||
from chia.wallet.util.address_type import AddressType | ||
|
||
|
||
def test_plotnft_command_default_parsing() -> None: | ||
launcher_id = bytes32([1] * 32) | ||
check_click_parsing( | ||
GetLoginLinkCMD(context=dict(), launcher_id=launcher_id), | ||
"--launcher_id", | ||
launcher_id.hex(), | ||
) | ||
|
||
burn_ph = bytes32.from_hexstr("0x000000000000000000000000000000000000000000000000000000000000dead") | ||
burn_address = encode_puzzle_hash(burn_ph, "xch") | ||
check_click_parsing( | ||
ChangePayoutInstructionsPlotNFTCMD( | ||
launcher_id=launcher_id, address=CliAddress(burn_ph, burn_address, AddressType.XCH) | ||
), | ||
"--launcher_id", | ||
launcher_id.hex(), | ||
"--address", | ||
burn_address, | ||
obj={"expected_prefix": "xch"}, # Needed for AddressParamType to work correctly without config | ||
) | ||
|
||
check_click_parsing( | ||
ClaimPlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), fee=uint64(1), id=5 | ||
), | ||
"--id", | ||
"5", | ||
"--fee", | ||
"0.000000000001", | ||
) | ||
|
||
check_click_parsing( | ||
CreatePlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), | ||
pool_url="http://localhost:1234", | ||
state="pool", | ||
fee=uint64(0), | ||
dont_prompt=False, | ||
), | ||
"--state", | ||
"pool", | ||
"--pool-url", | ||
"http://localhost:1234", | ||
"--fee", | ||
"0.0", | ||
) | ||
|
||
check_click_parsing( | ||
CreatePlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), | ||
pool_url=None, | ||
state="local", | ||
fee=uint64(0), | ||
dont_prompt=True, | ||
), | ||
"--state", | ||
"local", | ||
"-y", | ||
) | ||
|
||
check_click_parsing( | ||
InspectPlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), | ||
id=5, | ||
), | ||
"--id", | ||
"5", | ||
) | ||
|
||
check_click_parsing( | ||
JoinPlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), | ||
id=5, | ||
fee=uint64(3), | ||
pool_url="http://localhost:1234", | ||
dont_prompt=True, | ||
), | ||
"--id", | ||
"5", | ||
"--fee", | ||
"0.000000000003", | ||
"--pool-url", | ||
"http://localhost:1234", | ||
"-y", | ||
) | ||
|
||
check_click_parsing( | ||
LeavePlotNFTCMD( | ||
rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), | ||
id=5, | ||
fee=uint64(3), | ||
dont_prompt=True, | ||
), | ||
"--id", | ||
"5", | ||
"--fee", | ||
"0.000000000003", | ||
"-y", | ||
) | ||
|
||
check_click_parsing( | ||
ShowPlotNFTCMD( | ||
context=dict(), rpc_info=NeedsWalletRPC(client_info=None, wallet_rpc_port=None, fingerprint=None), id=5 | ||
), | ||
"--id", | ||
"5", | ||
) |
Oops, something went wrong.