Added a the beginnings of a test suite for the wiki. Fixed privilege check in the media folder.

This commit is contained in:
Roy Johnson 2006-12-21 16:19:37 +00:00
parent 4628a7f470
commit e92871629c
4 changed files with 49 additions and 1 deletions

View file

@ -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

View file

@ -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({

45
t/Asset/WikiPage.t Normal file
View file

@ -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);
}

View file

@ -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');