Author: dom
Date: 2007-06-12 22:56:36 +0100 (Tue, 12 Jun 2007)
New Revision: 1071
Modified:
trunk/t/17_commit_node.t
Log:
Refactor to use OpenGuides::Test
Modified: trunk/t/17_commit_node.t
===================================================================
--- trunk/t/17_commit_node.t 2007-06-12 21:47:03 UTC (rev 1070)
+++ trunk/t/17_commit_node.t 2007-06-12 21:56:36 UTC (rev 1071)
@@ -4,6 +4,7 @@
use OpenGuides;
use OpenGuides::Feed;
use OpenGuides::Utils;
+use OpenGuides::Test;
use Test::More;
eval { require DBD::SQLite; };
@@ -50,25 +51,13 @@
my $guide = OpenGuides->new( config => $config );
# Set up CGI parameters ready for a node write.
-# Most of these are in here to avoid uninitialised value warnings.
-my $q = CGI->new;
-$q->param( -name => "content", -value => "foo" );
-$q->param( -name => "categories", -value => "" );
-$q->param( -name => "locales", -value => "" );
-$q->param( -name => "phone", -value => "" );
-$q->param( -name => "fax", -value => "" );
-$q->param( -name => "website", -value => "" );
-$q->param( -name => "hours_text", -value => "" );
-$q->param( -name => "address", -value => "" );
-$q->param( -name => "postcode", -value => "" );
-$q->param( -name => "map_link", -value => "" );
-$q->param( -name => "os_x", -value => "" );
-$q->param( -name => "os_y", -value => "" );
-$q->param( -name => "username", -value => "bob" );
-$q->param( -name => "comment", -value => "foo" );
-$q->param( -name => "node_image", -value => "image" );
-$q->param( -name => "edit_type", -value => "Minor tidying" );
-$ENV{REMOTE_ADDR} = "127.0.0.1";
+my $q = OpenGuides::Test->make_cgi_object(
+ content => "foo",
+ username => "bob",
+ comment => "foo",
+ node_image => "image",
+ edit_type => "Minor tidying"
+);
my $output = $guide->commit_node(
return_output => 1,
@@ -99,23 +88,14 @@
is( $node{metadata}->{edit_type}[0], "Normal edit", "Right edit type" );
# Now try to commit some invalid data, and make sure we get an edit form back
-$q = CGI->new;
-$q->param( -name => "content", -value => "foo" );
-$q->param( -name => "categories", -value => "" );
-$q->param( -name => "locales", -value => "" );
-$q->param( -name => "phone", -value => "" );
-$q->param( -name => "fax", -value => "" );
-$q->param( -name => "website", -value => "" );
-$q->param( -name => "hours_text", -value => "" );
-$q->param( -name => "address", -value => "" );
-$q->param( -name => "postcode", -value => "" );
-$q->param( -name => "map_link", -value => "" );
-$q->param( -name => "os_x", -value => "fooooo" );
-$q->param( -name => "os_y", -value => "" );
-$q->param( -name => "username", -value => "bob" );
-$q->param( -name => "comment", -value => "foo" );
-$q->param( -name => "node_image", -value => "image" );
-$q->param( -name => "edit_type", -value => "Minor tidying" );
+my $q = OpenGuides::Test->make_cgi_object(
+ content => "foo",
+ os_x => "fooooo",
+ username => "bob",
+ comment => "foo",
+ node_image => "image",
+ edit_type => "Minor tidying"
+);
$output = $guide->commit_node(
return_output => 1,