folders: basic integration tests for folders

This commit is contained in:
Marcus Efraimsson
2018-02-20 14:00:32 +01:00
parent ea7998ca8e
commit b56e2a61f9
2 changed files with 95 additions and 1 deletions
+17 -1
View File
@@ -90,6 +90,18 @@ export async function createDashboard(user, dashboard) {
return dashboard;
}
export async function createFolder(user, folder) {
const rsp = await client.callAs(user).post(`/api/folders`, {
uid: folder.uid,
title: folder.title,
overwrite: true,
});
folder.id = rsp.id;
folder.url = rsp.url;
return folder;
}
export async function ensureState(state) {
const org = await getOrg(state.orgName);
@@ -99,9 +111,13 @@ export async function ensureState(state) {
await setUsingOrg(user, org);
}
for (let dashboard of state.dashboards) {
for (let dashboard of state.dashboards || []) {
await createDashboard(state.admin, dashboard);
}
for (let folder of state.folders || []) {
await createFolder(state.admin, folder);
}
return state;
}