diff --git a/electron-react/src/pages/backup/restoreBackup.js b/electron-react/src/pages/backup/restoreBackup.js
index dc9c87cb..1ce045bc 100644
--- a/electron-react/src/pages/backup/restoreBackup.js
+++ b/electron-react/src/pages/backup/restoreBackup.js
@@ -192,12 +192,22 @@ const BackupDetails = () => {
padding: "20px",
}}
>
-
- {" "}
-
+
+ {" "}
+
+
+
+ Import Backup File
+
+
Backup info:
diff --git a/src/rpc/wallet_rpc_api.py b/src/rpc/wallet_rpc_api.py
index 64537151..14cd2e5b 100644
--- a/src/rpc/wallet_rpc_api.py
+++ b/src/rpc/wallet_rpc_api.py
@@ -337,6 +337,11 @@ class WalletRpcApi:
async def create_backup_and_upload(self, host):
try:
+ if (
+ "testing" in self.service.config
+ and self.service.config["testing"] is True
+ ):
+ return
now = time.time()
file_name = f"backup_{now}"
path = path_from_root(self.service.root_path, file_name)
@@ -677,7 +682,9 @@ class WalletRpcApi:
fingerprint = request["fingerprint"]
type = request["type"]
recovery_host = request["host"]
-
+ testing = False
+ if "testing" in self.service.config and self.service.config["testing"] is True:
+ testing = True
if type == "skip":
started = await self.service._start(
fingerprint=fingerprint, skip_backup_import=True
@@ -692,6 +699,9 @@ class WalletRpcApi:
if started is True:
return {"success": True}
+ elif testing is True and self.service.backup_initialized is False:
+ response = {"success": False, "error": "not_initialized"}
+ return response
elif self.service.backup_initialized is False:
backup_info = None
backup_path = None
diff --git a/src/wallet/util/backup_utils.py b/src/wallet/util/backup_utils.py
index a8b76dc6..722e0d91 100644
--- a/src/wallet/util/backup_utils.py
+++ b/src/wallet/util/backup_utils.py
@@ -84,6 +84,7 @@ async def upload_backup(host: str, backup_text: str):
session = aiohttp.ClientSession()
nonce_url = f"{host}/upload_backup"
upload_response = await post(session, nonce_url, request)
+ await session.close()
return upload_response
@@ -111,5 +112,5 @@ async def download_backup(host: str, private_key: PrivateKey):
assert backup_response["success"] is True
backup_url = backup_response["url"]
backup_text = await get(session, backup_url)
-
+ await session.close()
return backup_text
diff --git a/tests/rl_wallet/test_rl_rpc.py b/tests/rl_wallet/test_rl_rpc.py
index 3e7f2190..fb579e9c 100644
--- a/tests/rl_wallet/test_rl_rpc.py
+++ b/tests/rl_wallet/test_rl_rpc.py
@@ -51,7 +51,7 @@ class TestCCWallet:
api_user = WalletRpcApi(wallet_node_1)
val = await api_user.create_new_wallet(
- {"wallet_type": "rl_wallet", "rl_type": "user"}
+ {"wallet_type": "rl_wallet", "rl_type": "user", "host": "127.0.0.1:5000"}
)
assert isinstance(val, dict)
assert val["success"]
@@ -69,6 +69,7 @@ class TestCCWallet:
"limit": 1,
"pubkey": pubkey,
"amount": 100,
+ "host": "127.0.0.1:5000"
}
)
assert isinstance(val, dict)
diff --git a/tests/setup_nodes.py b/tests/setup_nodes.py
index 5be2f734..aefa4077 100644
--- a/tests/setup_nodes.py
+++ b/tests/setup_nodes.py
@@ -159,6 +159,7 @@ async def setup_wallet_node(
if db_path.exists():
db_path.unlink()
config["database_path"] = str(db_name)
+ config["testing"] = True
api = WalletNode(
config,