Update of /cvsroot/openinteract/OpenInteract2/t
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19555/t
Modified Files:
url.t
Log Message:
add 'add_params_to_url()' to OI2::URL and a pointer to it from OI2::TT2::Plugin; plus tests
Index: url.t
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/t/url.t,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** url.t 4 Oct 2004 04:06:22 -0000 1.11
--- url.t 24 Nov 2004 14:16:01 -0000 1.12
***************
*** 7,11 ****
require 'utils.pl';
use OpenInteract2::Context qw( CTX );
! use Test::More tests => 96;
initialize_context();
--- 7,11 ----
require 'utils.pl';
use OpenInteract2::Context qw( CTX );
! use Test::More tests => 104;
initialize_context();
***************
*** 324,327 ****
--- 324,346 ----
}
+ {
+
+ CTX->assign_deploy_url( '' );
+ my %params = ( id => 55, undercover => 'yes' );
+ my $create_url = $UCL->add_params_to_url( '/foo', \%params );
+ compare_urls( '/foo', \%params, $create_url,
+ 'Add params to plain URL' );
+ $create_url = $UCL->add_params_to_url( '/foo?evil=very', \%params );
+ compare_urls( '/foo', { %params, evil => 'very' }, $create_url,
+ 'Add params to URL with query args' );
+ $create_url = $UCL->add_params_to_url( '/foo is bar', \%params );
+ compare_urls( '/foo is bar', \%params, $create_url,
+ 'Add params to plain URL and ensure it is not escaped' );
+ $create_url = $UCL->add_params_to_url( '/foo is bar?evil=very', \%params );
+ compare_urls( '/foo is bar', { %params, evil => 'very' }, $create_url,
+ 'Add params to URL with query args and ensure it is not escaped' );
+
+ }
+
# TODO: Once we get the test website/actions setup, create tests for
# parse_action() (we don't need as many -- just ones to test a known
|