@@ -41,19 +41,11 @@ def get_test_wallet(cls) -> MoneroWalletRpc:
4141
4242 @override
4343 def _open_wallet (self , config : MoneroWalletConfig | None ) -> MoneroWalletRpc :
44- try :
45- return Utils .open_wallet_rpc (config )
46- except Exception :
47- Utils .free_wallet_rpc_resources ()
48- raise
44+ return Utils .open_wallet_rpc (config )
4945
5046 @override
5147 def _create_wallet (self , config : MoneroWalletConfig ) -> MoneroWalletRpc :
52- try :
53- return Utils .create_wallet_rpc (config )
54- except Exception :
55- Utils .free_wallet_rpc_resources ()
56- raise
48+ return Utils .create_wallet_rpc (config )
5749
5850 @override
5951 def _close_wallet (self , wallet : MoneroWallet , save : bool = False ) -> None :
@@ -123,7 +115,6 @@ def test_get_subaddress_address_out_of_range(self, wallet: MoneroWallet) -> None
123115
124116 # Can create a wallet with a randomly generated seed
125117 @pytest .mark .skipif (Utils .TEST_NON_RELAYS is False , reason = "TEST_NON_RELAYS disabled" )
126- @pytest .mark .xfail (reason = "TODO setup another docker wallet-rpc" )
127118 def test_create_wallet_random_rpc (self ) -> None :
128119 # create random wallet with defaults
129120 path : str = StringUtils .get_random_string ()
@@ -146,14 +137,12 @@ def test_create_wallet_random_rpc(self) -> None:
146137 wallet = self ._create_wallet (config )
147138 MoneroUtils .validate_mnemonic (wallet .get_seed ())
148139 assert seed != wallet .get_seed ()
140+ seed = wallet .get_seed ()
149141 MoneroUtils .validate_address (wallet .get_primary_address (), Utils .NETWORK_TYPE )
150142
151143 # attempt to create wallet which already exists
152144 try :
153- config = MoneroWalletConfig ()
154- config .path = path
155- config .language = "Spanish"
156- self ._create_wallet (config )
145+ wallet .create_wallet (config )
157146 except MoneroError as e :
158147 err_msg : str = str (e )
159148 assert err_msg == f"Wallet already exists: { path } " , err_msg
@@ -209,10 +198,8 @@ def test_create_wallet_from_seed_rpc(self, daemon: MoneroDaemonRpc) -> None:
209198
210199 # Can open wallets
211200 @pytest .mark .skipif (Utils .TEST_NON_RELAYS is False , reason = "TEST_NON_RELAYS disabled" )
212- @pytest .mark .skip (reason = "TODO setup another docker monero-wallet-rpc resource" )
213201 def test_open_wallet (self )-> None :
214202 # create names of tests wallets
215- # TODO setup more wallet-rpc instances
216203 num_test_wallets : int = 1
217204 names : list [str ] = [ ]
218205 for i in range (num_test_wallets ):
@@ -238,23 +225,16 @@ def test_open_wallet(self)-> None:
238225 assert seeds [i ] == wallet .get_seed ()
239226 wallets .append (wallet )
240227
241- # attempt to re-open already opened wallet
242- try :
243- config : MoneroWalletConfig = MoneroWalletConfig ()
244- self ._open_wallet (config )
245- raise Exception ("Cannot open wallet wich is already open" )
246- except MoneroError as e :
247- # -1 indicates wallet does not exist (or is open by another app)
248- logger .critical (str (e ))
249-
250228 # attempt to open non-existent
251229 try :
252230 config : MoneroWalletConfig = MoneroWalletConfig ()
253231 config .path = "btc_integrity"
254232 config .password = Utils .WALLET_PASSWORD
233+ self ._open_wallet (config )
255234 raise Exception ("Cannot open non-existent wallet" )
256- except MoneroError as e :
257- logger .critical (e )
235+ except Exception as e :
236+ e_msg : str = str (e )
237+ assert e_msg != "Cannot open non-existent wallet" , e_msg
258238
259239 # close wallets:
260240 for wallet in wallets :
@@ -356,9 +336,4 @@ def test_get_public_spend_key(self, wallet: MoneroWallet) -> None:
356336 def test_import_key_images (self , wallet : MoneroWallet ) -> None :
357337 return super ().test_import_key_images (wallet )
358338
359- @pytest .mark .skip (reason = "TODO setup another docker monero-wallet-rpc resource" )
360- @override
361- def test_view_only_and_offline_wallets (self , wallet : MoneroWallet ) -> None :
362- return super ().test_view_only_and_offline_wallets (wallet )
363-
364339 #endregion
0 commit comments