From: Chris W. <la...@us...> - 2005-03-02 15:42:28
|
Update of /cvsroot/openinteract/OpenInteract2/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28549/t Modified Files: context.t manage_list_actions.t url.t utils.pl Log Message: OIN-135: test updates due to news package changes and to check REST-created URLs Index: context.t =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/context.t,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** context.t 25 Feb 2005 05:32:48 -0000 1.42 --- context.t 2 Mar 2005 15:42:13 -0000 1.43 *************** *** 81,85 **** is( ref $action_table, 'HASH', 'Action table is correct data structure' ); ! is( scalar keys %{ $action_table }, 43, 'Correct number of actions in table' ); --- 81,85 ---- is( ref $action_table, 'HASH', 'Action table is correct data structure' ); ! is( scalar keys %{ $action_table }, 44, 'Correct number of actions in table' ); Index: manage_list_actions.t =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/manage_list_actions.t,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** manage_list_actions.t 25 Feb 2005 05:32:48 -0000 1.8 --- manage_list_actions.t 2 Mar 2005 15:42:13 -0000 1.9 *************** *** 6,10 **** use lib 't/'; require 'utils.pl'; ! use Test::More tests => 48; require_ok( 'OpenInteract2::Manage' ); --- 6,10 ---- use lib 't/'; require 'utils.pl'; ! use Test::More tests => 49; require_ok( 'OpenInteract2::Manage' ); *************** *** 28,32 **** edit_document_box error_browser file_index forgotpassword group latest_news login_box logout lookups new new_comment_form ! news news_section news_tools_box newuser object_modify_box objectactivity package page pagedirectory pagescan powered_by_box search search_box security show_comment_by_object --- 28,32 ---- edit_document_box error_browser file_index forgotpassword group latest_news login_box logout lookups new new_comment_form ! news news_archive_monthly news_section news_tools_box newuser object_modify_box objectactivity package page pagedirectory pagescan powered_by_box search search_box security show_comment_by_object Index: url.t =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/url.t,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** url.t 28 Feb 2005 01:01:17 -0000 1.16 --- url.t 2 Mar 2005 15:42:13 -0000 1.17 *************** *** 7,11 **** require 'utils.pl'; use OpenInteract2::Context qw( CTX ); ! use Test::More tests => 135; initialize_context(); --- 7,11 ---- require 'utils.pl'; use OpenInteract2::Context qw( CTX ); ! use Test::More tests => 151; initialize_context(); *************** *** 158,168 **** is( $create_url, '/foo?bar=baz', 'Single query item' ); $create_url = $UCL->create( '/foo', { name => 'Stan Granite' } ); is( $create_url, '/foo?name=Stan%20Granite', 'Single query item with spaces' ); my %multiple_q = ( bar => 'baz', blah => 'blech' ); ! $create_url = $UCL->create( '/foo', \%multiple_q ); ! compare_urls( '/foo', \%multiple_q, $create_url, 'Multiple query items' ); my @unescaped = ( '~', '.', '-', '*', "'", '(', ')', '/' ); --- 158,185 ---- is( $create_url, '/foo?bar=baz', 'Single query item' ); + $create_url = $UCL->create( '/foo', { URL_PARAMS => 55, bar => 'baz' } ); + is( $create_url, '/foo/55?bar=baz', + 'Single query item with REST' ); + $create_url = $UCL->create( + '/foo', { URL_PARAMS => [ '55', 'whiteboard' ], bar => 'baz' } ); + is( $create_url, '/foo/55/whiteboard?bar=baz', + 'Single query item with multiple REST' ); $create_url = $UCL->create( '/foo', { name => 'Stan Granite' } ); is( $create_url, '/foo?name=Stan%20Granite', 'Single query item with spaces' ); + $create_url = $UCL->create( + '/foo', { URL_PARAMS => 'actor', name => 'Stan Granite' } ); + is( $create_url, '/foo/actor?name=Stan%20Granite', + 'Single query item with spaces and REST' ); + $create_url = $UCL->create( + '/foo', { URL_PARAMS => 'main actor', name => 'Stan Granite' } ); + is( $create_url, '/foo/main%20actor?name=Stan%20Granite', + 'Single query item with spaces and REST with spaces' ); my %multiple_q = ( bar => 'baz', blah => 'blech' ); ! compare_urls( '/foo', \%multiple_q, $UCL->create( '/foo', \%multiple_q ), 'Multiple query items' ); + $multiple_q{URL_PARAMS} = 'football'; + compare_urls( '/foo/football', \%multiple_q, $UCL->create( '/foo', \%multiple_q ), + 'Multiple query items with REST' ); my @unescaped = ( '~', '.', '-', '*', "'", '(', ')', '/' ); *************** *** 181,184 **** --- 198,209 ---- is( $create_url, '/some%20path/to/La%20Choy?emulate=Stan%20Granite', 'Path with spaces, query item with space' ); + $create_url = $UCL->create( '/some path/to/La Choy', + { URL_PARAMS => 'fake', emulate => 'Stan Granite' } ); + is( $create_url, '/some%20path/to/La%20Choy/fake?emulate=Stan%20Granite', + 'Path with spaces, query item with space with REST' ); + $create_url = $UCL->create( '/some path/to/La Choy', + { URL_PARAMS => 'not fake', emulate => 'Stan Granite' } ); + is( $create_url, '/some%20path/to/La%20Choy/not%20fake?emulate=Stan%20Granite', + 'Path with spaces, query item with space with REST having spaces' ); } *************** *** 188,203 **** --- 213,260 ---- is( $create_url, '/images/foo.gif', 'Simple image URL' ); + $create_url = $UCL->create_image( '/images/foo.gif', { size => 'max' } ); + is( $create_url, '/images/foo.gif?size=max', + 'Simple image URL with query args' ); + $create_url = $UCL->create_image( + '/images/foo.gif', { URL_PARAMS => 'default', size => 'max' } ); + is( $create_url, '/images/foo.gif/default?size=max', + 'Simple image URL with query args and REST' ); + CTX->assign_deploy_image_url( 'http://images.mycompany.com' ); $create_url = $UCL->create_image( '/images/foo.gif' ); is( $create_url, 'http://images.mycompany.com/images/foo.gif', 'Simple image URL with context' ); + $create_url = $UCL->create_image( '/images/foo.gif', { size => 'max' } ); + is( $create_url, 'http://images.mycompany.com/images/foo.gif?size=max', + 'Simple image URL with context and query args' ); + $create_url = $UCL->create_image( + '/images/foo.gif', { URL_PARAMS => 'default', size => 'max' } ); + is( $create_url, 'http://images.mycompany.com/images/foo.gif/default?size=max', + 'Simple image URL with context, query args and REST' ); $create_url = $UCL->create_static( '/reports/q1-2000.pdf' ); is( $create_url, '/reports/q1-2000.pdf', 'Simple static URL' ); + $create_url = $UCL->create_static( + '/reports/q1-2000.pdf', { resolution => 300 } ); + is( $create_url, '/reports/q1-2000.pdf?resolution=300', + 'Simple static URL with query args' ); + $create_url = $UCL->create_static( + '/reports/q1-2000.pdf', { URL_PARAMS => 'unlocked', resolution => 300 } ); + is( $create_url, '/reports/q1-2000.pdf/unlocked?resolution=300', + 'Simple static URL with query args and REST' ); + CTX->assign_deploy_static_url( 'http://static.mycompany.com' ); $create_url = $UCL->create_static( '/reports/q1-2000.pdf' ); is( $create_url, 'http://static.mycompany.com/reports/q1-2000.pdf', 'Simple static URL with context' ); + $create_url = $UCL->create_static( + '/reports/q1-2000.pdf', { resolution => 300 } ); + is( $create_url, 'http://static.mycompany.com/reports/q1-2000.pdf?resolution=300', + 'Simple static URL with context and query args' ); + $create_url = $UCL->create_static( + '/reports/q1-2000.pdf', { URL_PARAMS => 'unlocked', resolution => 300 } ); + is( $create_url, 'http://static.mycompany.com/reports/q1-2000.pdf/unlocked?resolution=300', + 'Simple static URL with context query args and REST' ); } Index: utils.pl =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/t/utils.pl,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** utils.pl 1 Mar 2005 03:31:19 -0000 1.96 --- utils.pl 2 Mar 2005 15:42:13 -0000 1.97 *************** *** 49,53 **** base_error => '3.02', base_group => '2.18', ! base_page => '2.20', base_security => '2.20', base_template => '3.17', --- 49,53 ---- base_error => '3.02', base_group => '2.18', ! base_page => '2.30', base_security => '2.20', base_template => '3.17', *************** *** 57,61 **** full_text => '2.61', lookup => '2.09', ! news => '2.21', object_activity => '2.13', system_doc => '2.10', --- 57,61 ---- full_text => '2.61', lookup => '2.09', ! news => '2.24', object_activity => '2.13', system_doc => '2.10', *************** *** 72,78 **** is( $path_created, $url_base, "$desc: base paths match" ); ! my %query_map = map { split( '=', $_ ) } split( '&', $query_created ); ! is_deeply( \%query_map, $query_base, "$desc: query strings match" ); } --- 72,81 ---- is( $path_created, $url_base, "$desc: base paths match" ); ! my %query_actual = map { split( '=', $_ ) } split( '&', $query_created ); ! my %query_expected = map { $_ => $query_base->{ $_ } } ! grep { $_ ne 'URL_PARAMS' } ! keys %{ $query_base }; ! is_deeply( \%query_actual, \%query_expected, "$desc: query strings match" ); } |