Commit e1733ac3 authored by Rob Hulswit's avatar Rob Hulswit

Merge branch 'feature/ah.rollup.20200317' into 'master'

Feature/ah.rollup.20200317

See merge request webhare/platform!231
parents 2604376c 102a642a
......@@ -2117,17 +2117,27 @@ PUBLIC STATIC OBJECTTYPE ObjectProps EXTEND TolliumScreenBase
}
}
// check for site conflict - do this first as even moving the site won't fix it
IF(ObjectExists(this->sourceitem) AND this->sourceitem->parentsite = this->sourceitem->id)
{
OBJECT othersite := OpenSiteByName(name);
IF(ObjectExists(othersite) AND othersite->id != this->sourceitem->id)
{
work->AddError(GetTid("publisher:commondialogs.errors.objectprops.sitealreadyexists", name));
RETURN work->Finish();
}
}
// Test for an object with the same name at the target location
OBJECT otherobject := this->parentfolder->OpenByName(name);
IF (ObjectExists(otherobject) AND otherobject->id != this->itemid)
{
BOOLEAN hiddenforme := IsObjectHiddenForMe(GetEffectiveUser(), otherobject->id);
OBJECT subwork := this->BeginFeedback();
IF(hiddenforme)
subwork->AddError(GetTid("publisher:common.errors.hiddenfolderexists", name, this->parentfolder->name));
work->AddError(GetTid("publisher:common.errors.hiddenfolderexists", name, this->parentfolder->name));
ELSE
subwork->AddError(GetTid("publisher:common.errors.fileorfolderexists", name, this->parentfolder->name));
RETURN subwork->Finish();
work->AddError(GetTid("publisher:common.errors.fileorfolderexists", name, this->parentfolder->name));
RETURN work->Finish();
}
RECORD indexactions;
......
......@@ -1485,7 +1485,7 @@ PUBLIC STATIC OBJECTTYPE App EXTEND TolliumScreenBase
}
IF(ObjectExists(OpenSiteByName(obj.name)))
{
this->RunMessageBox(".sitealreadyexists", obj.name);
this->RunSimpleScreen("error", GetTid("publisher:commondialogs.errors.objectprops.sitealreadyexists", obj.name));
RETURN;
}
OBJECT confirm := this->LoadScreen(".converttositedialog", [ site := obj.name ]);
......
......@@ -83,7 +83,7 @@ INTEGER FUNCTION TryAddWHFSRegister(RECORD slot, INTEGER for_deleted_file)
RETURN slotfile->filelink;
}
STRING aboutslot := `WHFS register slot '${slot.module}:${slot.name}' ${for_deleted_file != 0 ? ` refers to deleted object #${for_deleted_file}` : `has not been set`}`;
STRING aboutslot := `WHFS register slot '${slot.module}:${slot.name}' ${for_deleted_file != 0 ? `refers to deleted object #${for_deleted_file}` : `has not been set`}`;
INTEGER target;
IF(modinfo.initialvalue != "")
target := LookupWHFSObject(0, modinfo.initialvalue);
......
......@@ -293,7 +293,7 @@
<formcomponents namespace="http://www.webhare.net/xmlns/webhare_testsuite/testformcomponents" xmlschema="tests/publisher/forms/data/testformcomponents.xsd"/>
<registerslot name="testsite" tid="module.testsite.title" descriptiontid="module.testsite.description" initialvalue="site::webhare testsuite site" type="site" />
<registerslot name="testslot" title="Test Slot" description="Test Description" initialvalue="whfs::/webhare_testsuite.testfolder/testslot" type="folder" />
<registerslot name="testslot" title="Test Slot" description="Test Description" initialvalue="whfs::/webhare_testsuite.testfolder/testslot" type="folder" fallback="whfs::/webhare_testsuite.testfolder/testslot-fallback"/>
</publisher>
<consilio>
......
......@@ -2,14 +2,14 @@
LOADLIB "wh::files.whlib";
LOADLIB "mod::system/lib/testframework.whlib";
LOADLIB "mod::tollium/lib/testframework.whlib";
LOADLIB "mod::publisher/lib/commondialogs.whlib";
LOADLIB "mod::system/lib/database.whlib";
LOADLIB "mod::publisher/lib/testframework.whlib";
LOADLIB "mod::webhare_testsuite/lib/system/tests.whlib";
MACRO PrepIt()
{
testfw->BeginWork();
testfw->GetUserObject("lisa")->GrantRightToOn("system:fs_fullaccess", testfw->GetUserObject("lisa"), testfw->GetTestSite()->rootobject->id, FALSE, TRUE);
testfw->GetUserObject("lisa")->GrantRightToOn("system:fs_fullaccess", testfw->GetUserObject("lisa"), OpenTestsuiteSite()->rootobject->id, FALSE, TRUE);
testfw->CommitWork();
}
......@@ -17,18 +17,14 @@ MACRO PrepIt()
//
// ObjectProps
//
OBJECT ASYNC FUNCTION ObjectProps()
ASYNC MACRO ObjectProps()
{
testfw->SetTestUser("sysop");
PrepareTestModuleWebDesignWebsite("webhare_testsuite:basetest");
testfw->SetTestUser("lisa");
TestEq(TRUE, ObjectExists(testfw->GetTestSite()));
testfw->BeginWork();
OBJECT root := testfw->GetTestSite()->rootobject;
OBJECT propsfolder := root->CreateFolder([name := "propstest"]);
OBJECT root := OpenTestsuiteSite()->rootobject;
OBJECT propsfolder := GetTestsuiteTempFolder()->CreateFolder([name := "propstest"]);
OBJECT imgfile := propsfolder->CreateFile([name:="img.jpg", data := GetHarescriptResource("mod::webhare_testsuite/data/test/bob.jpg"), publish := TRUE ]);
OBJECT imglink := propsfolder->CreateFile([name:="imglink.jpg", type := 20, filelink := imgfile->id, publish := TRUE ]);
imglink->SetInstanceData("http://www.webhare.net/xmlns/beta/test"
......@@ -37,9 +33,8 @@ OBJECT ASYNC FUNCTION ObjectProps()
testfw->SetTestUser("sysop");
OBJECT dialog := CreateWHFSObjectPropsDialog(GetTestController(), imglink->id);
AWAIT ExpectScreenChange(+1, PTR dialog->RunModal);
AWAIT ExpectScreenChange(+1, PTR TTLaunchApp("publisher:app", [ calltype := "direct", params := STRING[imglink->whfspath] ]));
AWAIT ExpectScreenChange(+1, PTR TTClick("props"));
AWAIT ExpectScreenChange(+1, PTR TT("path")->__test_executebrowse());
//the thumbnail view should have inited.
......@@ -54,8 +49,8 @@ OBJECT ASYNC FUNCTION ObjectProps()
AWAIT ExpectScreenChange(+1, PTR arrayedit->addbutton->TolliumClick());
TT("textcell")->value := "New row";
INTEGER staticfile := SELECT AS INTEGER rowkey FROM TT("_whfscell")->options WHERE title = "/webhare_testsuite.testfolder/webhare_testsuite.site/static.html";
TestEq(TRUE, staticfile != 0, "Where is my static.html?");
INTEGER staticfile := SELECT AS INTEGER rowkey FROM TT("_whfscell")->options WHERE title = "/WebHare testsuite site/index.rtd";
TestEq(TRUE, staticfile != 0, "Where is my index.rtd?");
TT("_whfscell")->value := staticfile;
AWAIT ExpectScreenChange(-1, PTR topscreen->TolliumExecuteSubmit());
......@@ -70,33 +65,29 @@ OBJECT ASYNC FUNCTION ObjectProps()
AWAIT ExpectScreenChange(-1, PTR topscreen->TolliumExecuteSubmit());
AWAIT ExpectScreenChange(-1, PTR topscreen->TolliumExecuteSubmit());
Testeq("ok", dialog->tolliumresult);
RECORD data := imglink->GetInstanceData("http://www.webhare.net/xmlns/beta/test");
TestEq(2, Length(data.arraytest));
RETURN TRUE;
AWAIT ExpectScreenChange(-1, PTR TTescape);
}
OBJECT ASYNC FUNCTION SiteProps()
ASYNC MACRO TestRenameSiteConflict()
{
PrepareTestModuleWebDesignWebsite("webhare_testsuite:basetest");
TestEq(TRUE, ObjectExists(testfw->GetTestSite()));
AWAIT ExpectScreenChange(+1, PTR TTLaunchApp("publisher:app", [ calltype := "direct", params := STRING[ OpenTestsuiteSite()->rootobject->whfspath ] ]));
OBJECT root := testfw->GetTestSite()->rootobject;
topscreen->frame->focused := TT("foldertree");
AWAIT ExpectScreenChange(+1, PTR TTClick("props"));
TestEq(OpenTestsuiteSite()->rootobject->name, TT(":Name")->value);
TT(":Name")->value := "WebHare Backend";
testfw->SetTestUser("sysop");
OBJECT sitedialog := CreateWHFSSitePropsDialog(GetTestController(), root->id);
AWAIT ExpectScreenChange(+1, PTR sitedialog->RunModal()); //simply should not crash
TT("locksite")->value := TRUE;
AWAIT ExpectScreenChange(-1, PTR topscreen->TolliumExecuteSubmit());
BOOLEAN lockstatus := SELECT AS BOOLEAN locked FROM system.sites WHERE id = VAR root->id;
TestEq(TRUE, lockstatus);
RETURN TRUE;
AWAIT ExpectAndAnswerMessageBox("ok", PTR TTClick(":Ok"), [ messagemask := "*site*WebHare Backend*exists*" ]);
AWAIT ExpectScreenChange(-1, PTR TTEscape);
AWAIT ExpectScreenChange(-1, PTR TTescape);
}
RunTestframework([ PTR ObjectProps
, PTR SiteProps
, PTR TestRenameSiteConflict
], [ testusers := [[ login := "sysop", grantrights := ["system:sysop"] ]
,[ login := "lisa" ]
]]);
<?wh
LOADLIB "wh::files.whlib";
LOADLIB "mod::system/lib/testframework.whlib";
LOADLIB "mod::tollium/lib/testframework.whlib";
LOADLIB "mod::publisher/lib/commondialogs.whlib";
LOADLIB "mod::system/lib/database.whlib";
LOADLIB "mod::publisher/lib/testframework.whlib";
OBJECT ASYNC FUNCTION SiteProps()
{
PrepareTestModuleWebDesignWebsite("webhare_testsuite:basetest");
TestEq(TRUE, ObjectExists(testfw->GetTestSite()));
OBJECT root := testfw->GetTestSite()->rootobject;
testfw->SetTestUser("sysop");
OBJECT sitedialog := CreateWHFSSitePropsDialog(GetTestController(), root->id);
AWAIT ExpectScreenChange(+1, PTR sitedialog->RunModal()); //simply should not crash
TT("locksite")->value := TRUE;
AWAIT ExpectScreenChange(-1, PTR topscreen->TolliumExecuteSubmit());
BOOLEAN lockstatus := SELECT AS BOOLEAN locked FROM system.sites WHERE id = VAR root->id;
TestEq(TRUE, lockstatus);
RETURN TRUE;
}
RunTestframework([ PTR SiteProps
], [ testusers := [[ login := "sysop", grantrights := ["system:sysop"] ]
,[ login := "lisa" ]
]]);
<group xmlns="http://www.webhare.net/xmlns/system/testinfo">
<test script="test_objectprops.whscr" />
<test script="test_siteprops.whscr" />
<test script="test_types.whscr" />
</group>
<group xmlns="http://www.webhare.net/xmlns/system/testinfo">
<test script="filemanager.whscr"/>
<test script="objectprops.whscr"/>
<test script="testfilemgr-newobject.whscr"/>
<test script="testfilemgr-upload.whscr"/>
......
......@@ -82,7 +82,7 @@ MACRO TestRegister()
testslotfolder->UpdateMetadata([name := "testslot3"]);
testfw->CommitWork();
TestEq(testslotfolder->id, LookupInWHFSRegister("webhare_testsuite:testslot"), "should follow the new entry after ename");
TestEq(testslotfolder->id, LookupInWHFSRegister("webhare_testsuite:testslot"), "should follow the new entry after rename");
testfw->BeginWork();
testslotfolder->RecycleSelf();
......@@ -95,6 +95,20 @@ MACRO TestRegister()
testfw->CommitWork();
TestEq(testslotfolder->id, LookupInWHFSRegister("webhare_testsuite:testslot"));
testfw->BeginWork();
testslotfolder->DeleteSelf();
OBJECT fallbackfolder := testfw->GetWHFSTestRoot()->CreateFolder([name := "testslot-fallback"]);
testfw->CommitWork();
TestEq(fallbackfolder->id, LookupInWHFSRegister("webhare_testsuite:testslot"));
testfw->BeginWork();
testslotfolder := testfw->GetWHFSTestRoot()->CreateFolder([name := "testslot"]);
testfw->CommitWork();
//should switch over to 'real' location as the fallback isn't actually stored
TestEq(testslotfolder->id, LookupInWHFSRegister("webhare_testsuite:testslot"));
}
MACRO TestOrphans()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment