fix(backups): разделить загрузку каталогов и права действий
This commit is contained in:
1 parent
b460997cbf
commit
3dcc7c9ea6
11 files changed
+259
-91
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import type { Page } from "@playwright/test"
|
||||
export { server } from "./users"
|
||||
import { server } from "./users"
|
||||
export const backup = { id: "backup-1", serverId: 1, serverName: "router", filename: "live-config.rsc", sizeBytes: 0, createdAt: "2026-10-01T00:00:00Z", kind: "manual", storage: "local" }
|
||||
export const schedule = { enabled: false, frequency: "daily", hour: 0, minute: 0, weekDay: 0, monthDay: 1, keepCount: 7, format: "rsc", serverIds: ["1"] }
|
||||
export const storage = { provider: "local", s3Endpoint: "", s3Region: "", s3Bucket: "", s3Prefix: "", s3AccessKeyId: "", secretConfigured: false, s3ForcePathStyle: false, keepLocalCopy: false }
|
||||
export async function setupBackups(page: Page, headers: Record<string, string> = {}) {
|
||||
await page.route("**/health", r => r.fulfill({ headers, json: { ok: true } }))
|
||||
await page.route("**/api/**", r => {
|
||||
const path = new URL(r.request().url()).pathname
|
||||
return r.fulfill({ headers, json: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? [server] : path === "/api/backups" ? [backup] : path === "/api/backups/schedule" ? schedule : path === "/api/backups/storage" ? storage : {} })
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user