File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed
tests/e2e_tests/subcommands/wallet Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change
1
+ from bittensor .commands .list import ListCommand
2
+ from bittensor .commands .wallets import WalletCreateCommand
3
+ from bittensor .subtensor import subtensor
4
+
5
+ from ...utils import setup_wallet
6
+
7
+
8
+ def test_wallet_list (capsys ):
9
+ """
10
+ Test the listing of wallets in the Bittensor network.
11
+
12
+ Steps:
13
+ 1. Set up a default wallet
14
+ 2. List existing wallets and verify the default setup
15
+ 3. Create a new wallet
16
+ 4. List wallets again and verify the new wallet is present
17
+
18
+ Raises:
19
+ AssertionError: If any of the checks or verifications fail
20
+ """
21
+
22
+ wallet_path_name = "//Alice"
23
+ base_path = f"/tmp/btcli-e2e-wallet-list-{ wallet_path_name .strip ('/' )} "
24
+ keypair , exec_command , wallet = setup_wallet (wallet_path_name )
25
+
26
+ # List initial wallets
27
+ exec_command (
28
+ ListCommand ,
29
+ [
30
+ "wallet" ,
31
+ "list" ,
32
+ ],
33
+ )
34
+
35
+ captured = capsys .readouterr ()
36
+ # Assert the default wallet is present in the display
37
+ assert "default" in captured .out
38
+ assert "└── default" in captured .out
39
+
40
+ # Create a new wallet
41
+ exec_command (
42
+ WalletCreateCommand ,
43
+ [
44
+ "wallet" ,
45
+ "create" ,
46
+ "--wallet.name" ,
47
+ "new_wallet" ,
48
+ "--wallet.hotkey" ,
49
+ "new_hotkey" ,
50
+ "--no_password" ,
51
+ "--overwrite_coldkey" ,
52
+ "--overwrite_hotkey" ,
53
+ "--no_prompt" ,
54
+ "--wallet.path" ,
55
+ base_path ,
56
+ ],
57
+ )
58
+
59
+ # List wallets again
60
+ exec_command (
61
+ ListCommand ,
62
+ [
63
+ "wallet" ,
64
+ "list" ,
65
+ ],
66
+ )
67
+
68
+ captured = capsys .readouterr ()
69
+
70
+ # Verify the new wallet is displayed
71
+ assert "new_wallet" in captured .out
72
+ assert "new_hotkey" in captured .out
You can’t perform that action at this time.
0 commit comments