fix(test): Use standard test site for cli invokations
This commit is contained in:
parent
74c56c2e63
commit
d18f4e717f
1 changed files with 8 additions and 8 deletions
|
|
@ -194,35 +194,35 @@ class TestCommands(BaseTestCommands):
|
|||
"root_password": frappe.conf.root_password,
|
||||
"db_type": frappe.conf.db_type,
|
||||
}
|
||||
site_data = {"another_site": f"{frappe.local.site}-restore.test", **global_config}
|
||||
site_data = {"test_site": TEST_SITE, **global_config}
|
||||
for key, value in global_config.items():
|
||||
if value:
|
||||
self.execute(f"bench set-config {key} {value} -g")
|
||||
self.execute(
|
||||
"bench new-site {another_site} --admin-password {admin_password} --db-type"
|
||||
"bench new-site {test_site} --admin-password {admin_password} --db-type"
|
||||
" {db_type}",
|
||||
site_data,
|
||||
)
|
||||
|
||||
# test 1: bench restore from full backup
|
||||
self.execute("bench --site {another_site} backup --ignore-backup-conf", site_data)
|
||||
self.execute("bench --site {test_site} backup --ignore-backup-conf", site_data)
|
||||
self.execute(
|
||||
"bench --site {another_site} execute frappe.utils.backups.fetch_latest_backups",
|
||||
"bench --site {test_site} execute frappe.utils.backups.fetch_latest_backups",
|
||||
site_data,
|
||||
)
|
||||
site_data.update({"database": json.loads(self.stdout)["database"]})
|
||||
self.execute("bench --site {another_site} restore {database}", site_data)
|
||||
self.execute("bench --site {test_site} restore {database}", site_data)
|
||||
|
||||
# test 2: restore from partial backup
|
||||
self.execute("bench --site {another_site} backup --exclude 'ToDo'", site_data)
|
||||
self.execute("bench --site {test_site} backup --exclude 'ToDo'", site_data)
|
||||
site_data.update({"kw": "\"{'partial':True}\""})
|
||||
self.execute(
|
||||
"bench --site {another_site} execute"
|
||||
"bench --site {test_site} execute"
|
||||
" frappe.utils.backups.fetch_latest_backups --kwargs {kw}",
|
||||
site_data,
|
||||
)
|
||||
site_data.update({"database": json.loads(self.stdout)["database"]})
|
||||
self.execute("bench --site {another_site} restore {database}", site_data)
|
||||
self.execute("bench --site {test_site} restore {database}", site_data)
|
||||
self.assertEqual(self.returncode, 1)
|
||||
|
||||
def test_partial_restore(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue