From e92871629c4b4f621a5bfc4421b14fafaf18e9f5 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Thu, 21 Dec 2006 16:19:37 +0000 Subject: [PATCH] Added a the beginnings of a test suite for the wiki. Fixed privilege check in the media folder. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Operation/FormHelpers.pm | 2 +- t/Asset/WikiPage.t | 45 +++++++++++++++++++++++++++++ t/Asset/Wobject/Calendar.t | 2 ++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 t/Asset/WikiPage.t diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 436537360..d0b28ac09 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -20,6 +20,7 @@ - fix: SQLForm - Using radio buttons would error when re-edited (Martin Kamerbeek / Oqapi) - fix: SQLForm - DBD Error handling (Martin Kamerbeek / Oqapi) + - fix: Media folder permission check 7.3.1 diff --git a/lib/WebGUI/Operation/FormHelpers.pm b/lib/WebGUI/Operation/FormHelpers.pm index bd2266737..7e867ebe6 100644 --- a/lib/WebGUI/Operation/FormHelpers.pm +++ b/lib/WebGUI/Operation/FormHelpers.pm @@ -373,7 +373,7 @@ sub www_richEditAddFolderSave { # get base url my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); # check if user can edit the current asset - return WebGUI::Privilege::insufficient() unless $base->canEdit; + return $session->privilege->insufficient() unless $base->canEdit; my $filename = $session->form->process('filename') || 'untitled'; $base->addChild({ diff --git a/t/Asset/WikiPage.t b/t/Asset/WikiPage.t new file mode 100644 index 000000000..b64f486f3 --- /dev/null +++ b/t/Asset/WikiPage.t @@ -0,0 +1,45 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2006 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; + +##The goal of this test is to test the creation of a WikiPage Asset. + +use WebGUI::Test; +use WebGUI::Session; +use Test::More tests => 3; # increment this value for each test you create +use WebGUI::Asset::Wobject::WikiMaster; +use WebGUI::Asset::WikiPage; + + +my $session = WebGUI::Test->session; +my $node = WebGUI::Asset->getImportNode($session); +my $versionTag = WebGUI::VersionTag->getWorking($session); +$versionTag->set({name=>"Wiki Test"}); + +my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster'}); +my $wikipage = $wiki->addChild({className=>'WebGUI::Asset::WikiPage'}); + +# Test for sane object types +isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster'); +isa_ok($wikipage, 'WebGUI::Asset::WikiPage'); + +TODO: { + local $TODO = "Tests to make later"; + ok(0, 'Lots and lots to do'); +} + +END { + # Clean up after thy self + $versionTag->rollback($versionTag->getId); +} + diff --git a/t/Asset/Wobject/Calendar.t b/t/Asset/Wobject/Calendar.t index 9da16a99d..2817cb8d0 100644 --- a/t/Asset/Wobject/Calendar.t +++ b/t/Asset/Wobject/Calendar.t @@ -39,6 +39,8 @@ isa_ok($event, 'WebGUI::Asset::Event','Can add Events as a child to the calendar my $article = $cal->addChild({className=>"WebGUI::Asset::Wobject::Article"}); isnt(ref $article, 'WebGUI::Asset::Wobject::Article', "Can't add an article as a child to the calendar."); + + TODO: { local $TODO = "Tests to make later"; ok(0, 'Lots more to test');