don't run in tests
This commit is contained in:
parent
5fec4056b2
commit
d37a8978ce
|
@ -192,12 +192,22 @@ const BackupDetails = () => {
|
|||
padding: "20px",
|
||||
}}
|
||||
>
|
||||
<ArrowBackIosIcon
|
||||
style={{ cursor: "pointer" }}
|
||||
<Box
|
||||
display="flex"
|
||||
onClick={goBackBackup}
|
||||
style={{ cursor: "pointer", minWidth: "100%" }}
|
||||
>
|
||||
{" "}
|
||||
</ArrowBackIosIcon>
|
||||
<Box>
|
||||
{" "}
|
||||
<ArrowBackIosIcon
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={goBackBackup}
|
||||
></ArrowBackIosIcon>
|
||||
</Box>
|
||||
<Box className={classes.align_left} flexGrow={1}>
|
||||
<Typography variant="subtitle2">Import Backup File</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
<Grid container spacing={3} style={{ marginBottom: 10 }}>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="subtitle1">Backup info:</Typography>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue