From 9a8c3f2dddf86ebc0303329f7e4a22c8c3c5d314 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 5 Feb 2008 20:48:28 +0000 Subject: [PATCH] forward port AdSpace tests from branch 7.4 --- t/Operation/AdSpace.t | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 t/Operation/AdSpace.t diff --git a/t/Operation/AdSpace.t b/t/Operation/AdSpace.t new file mode 100644 index 000000000..cc8888521 --- /dev/null +++ b/t/Operation/AdSpace.t @@ -0,0 +1,75 @@ +# vim:syntax=perl +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2007 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 +#------------------------------------------------------------------ + +# This tests the operation of saving the AdSpaces +# +# + +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 WebGUI::AdSpace; +use WebGUI::Operation::AdSpace; + +#---------------------------------------------------------------------------- +# Init +my $session = WebGUI::Test->session; +my $adSpace; + +#---------------------------------------------------------------------------- +# Tests + +plan tests => 3; # Increment this number for each test you create + +#---------------------------------------------------------------------------- +# Test that AdSpace name can't have ']' characters in them + +# Create an AdSpace to verify the saving +$adSpace = WebGUI::AdSpace->create( $session, { name => 'oldname', } ); + +my $output + = WebGUI::Test->getPage( + 'WebGUI::Operation::AdSpace::www_editAdSpaceSave', + undef, + { + args => [ $session ], + formParams => { + adSpaceId => $adSpace->getId, + name => 'This should ] fail', + }, + userId => 3, + }, + ); + +like( + $output, + qr/error/, + "Notifies user that an error occurred", +); + +like( + $output, + qr/invalid/, + "Notifies user what the error is", +); + +ok( $adSpace->get('name') eq 'oldname', 'AdSpace does not get saved.' ); + +$adSpace->delete; + +#---------------------------------------------------------------------------- +# Cleanup +END { + +}