Fix more JSON errors in WebGUI.conf.original

Add a test to make sure that it is valid JSON.
This commit is contained in:
Colin Kuskie 2008-07-12 04:26:23 +00:00
parent ba677052b1
commit 9e4394808f
2 changed files with 66 additions and 3 deletions

View file

@ -248,7 +248,7 @@
"WebGUI::Asset::Wobject::SyndicatedContent",
"WebGUI::Asset::Wobject::Thingy",
"WebGUI::Asset::Wobject::TimeTracking",
"WebGUI::Asset::Wobject::UserList"
"WebGUI::Asset::Wobject::UserList",
"WebGUI::Asset::Wobject::WeatherData",
"WebGUI::Asset::Wobject::WSClient"
],
@ -258,7 +258,7 @@
# management.
"utilityAssets" : [
"WebGUI::Asset::File"
"WebGUI::Asset::File",
"WebGUI::Asset::File::Image",
"WebGUI::Asset::RichEdit",
"WebGUI::Asset::Template"
@ -434,7 +434,7 @@
"WebGUI::Workflow::Activity::ExpireGroupings",
"WebGUI::Workflow::Activity::ExpireSubscriptionCodes",
"WebGUI::Workflow::Activity::GetSyndicatedContent",
"WebGUI::Workflow::Activity::NotifyAdminsWithOpenVersionTags"
"WebGUI::Workflow::Activity::NotifyAdminsWithOpenVersionTags",
"WebGUI::Workflow::Activity::ProcessRecurringPayments",
"WebGUI::Workflow::Activity::PurgeOldAssetRevisions",
"WebGUI::Workflow::Activity::PurgeOldTrash",

63
t/WebGUI_conf.t Normal file
View file

@ -0,0 +1,63 @@
# vim:syntax=perl
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 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
#------------------------------------------------------------------
# Test the default WebGUI.conf file to make sure it is valid JSON.
use FindBin;
use strict;
use lib "$FindBin::Bin/lib";
use Test::More;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
use JSON;
use Path::Class;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 3; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
my $defaultConfigFile = Path::Class::File->new(WebGUI::Test->root, qw/etc WebGUI.conf.original/);
ok (-e $defaultConfigFile->stringify, 'WebGUI.conf.original exists');
open my $jsonHandle, join('', '<', $defaultConfigFile->stringify);
my $jsonText;
{
local $/;
$jsonText = <$jsonHandle>;
}
close $jsonHandle;
ok($jsonText, 'The file is not empty');
my $perlScalar;
eval { $perlScalar = JSON->new->relaxed(1)->decode($jsonText) };
diag $@;
if ($@) {
my $index;
($index) = $@ =~ /character offset (\d+)/;
my $fragment = substr $jsonText, int($index/100)*100, 100;
diag "Problem found in default WebGUI.conf file, look near here:";
diag $fragment;
}
ok( defined $perlScalar, 'JSON is valid');