From: Stephen D. <sd...@us...> - 2005-04-27 00:19:25
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23787 Modified Files: ns_serverpath.test ns_pagepath.test ns_conn_host.test Log Message: Convert to new nstest_http command and use seperate virtual hosts for tests. Index: ns_serverpath.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_serverpath.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_serverpath.test 12 Apr 2005 06:21:24 -0000 1.1 --- ns_serverpath.test 27 Apr 2005 00:19:14 -0000 1.2 *************** *** 10,16 **** set serverroot [file join [ns_config "test" home] \ ! [ns_config "ns/server/test/fastpath" serverdir]] ! set vhosts [ns_config "ns/server/test/vhost" hostprefix] --- 10,27 ---- + + # + # Three test environments: + # + # 1) server with virtual hosting disabled. + # 2) server with virtual hosting enabled. + # 3) server with custom serverroot and location procs registered. + # + + + set serverroot [file join [ns_config "test" home] \ ! [ns_config "ns/server/testvhost/fastpath" serverdir]] ! set vhosts [ns_config "ns/server/testvhost/vhost" hostprefix] *************** *** 20,27 **** test ns_serverpath-1.2 {basic path} -body { ns_serverpath foo bar } -result ${serverroot}/foo/bar ! test ns_serverpath-1.3 {basic path} -body { ns_serverpath -- foo bar } -result ${serverroot}/foo/bar --- 31,42 ---- test ns_serverpath-1.2 {basic path} -body { + ns_serverpath -- + } -result $serverroot + + test ns_serverpath-1.3 {basic path} -body { ns_serverpath foo bar } -result ${serverroot}/foo/bar ! test ns_serverpath-1.4 {basic path} -body { ns_serverpath -- foo bar } -result ${serverroot}/foo/bar *************** *** 30,84 **** test ns_serverpath-2.1 {host path} -body { ! ns_serverpath -host example.com ! } -result ${serverroot}/${vhosts}/e/x/a/example.com - test ns_serverpath-2.2 {host path} -body { - ns_serverpath -host EXAMPLE.COM - } -result ${serverroot}/${vhosts}/e/x/a/example.com - test ns_serverpath-2.3 {host path} -body { - ns_serverpath -host www.example.com - } -result ${serverroot}/${vhosts}/e/x/a/example.com ! test ns_serverpath-2.4 {host path} -body { ! ns_serverpath -host www.example.com:80 ! } -result ${serverroot}/${vhosts}/e/x/a/example.com ! test ns_serverpath-2.5 {host path} -body { ! ns_serverpath -host 1 ! } -result ${serverroot}/${vhosts}/1/_/_/1 ! test ns_serverpath-2.6 {host path} -body { ! ns_serverpath -host "" ! } -result ${serverroot} ! test ns_serverpath-3.1 {bad host} -body { ns_serverpath -host " " } -result ${serverroot} ! test ns_serverpath-3.2 {bad host} -body { ns_serverpath -host / } -result ${serverroot} ! test ns_serverpath-3.3 {bad host} -body { ns_serverpath -host ../example.com } -result ${serverroot} ! test ns_serverpath-3.4 {bad host} -body { ns_serverpath -host www.example.com//naughty } -result ${serverroot} ! test ns_serverpath-3.5 {bad host} -body { ns_serverpath -host www.example.com/../naughty } -result ${serverroot} ! test ns_serverpath-3.6 {bad host} -body { ns_serverpath -host .. 2dots } -result ${serverroot}/2dots ! test ns_serverpath-3.6 {bad host} -body { ns_serverpath -host ... 3dots } -result ${serverroot}/3dots --- 45,127 ---- test ns_serverpath-2.1 {host path} -body { ! ns_serverpath -host example.com -- x y ! } -result ${serverroot}/x/y ! test ns_serverpath-3.1 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath ! } -result [list 200 ${serverroot}/${vhosts}/t/e/s/testvhost] ! test ns_serverpath-3.2 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host=example.com ! } -result [list 200 ${serverroot}/${vhosts}/e/x/a/example.com] ! test ns_serverpath-3.3 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host=EXAMPLE.COM ! } -result [list 200 ${serverroot}/${vhosts}/e/x/a/example.com] + test ns_serverpath-3.4 {virtual host path} -body { + nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host=www.example.com + } -result [list 200 ${serverroot}/${vhosts}/e/x/a/example.com] + test ns_serverpath-3.5 {virtual host path} -body { + nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host=www.example.com:80 + } -result [list 200 ${serverroot}/${vhosts}/e/x/a/example.com] + test ns_serverpath-3.6 {virtual host path} -body { + nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host=1 + } -result [list 200 ${serverroot}/${vhosts}/1/_/_/1] ! test ns_serverpath-3.7 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /serverpath?host= ! } -result [list 200 ${serverroot}] ! ! ! ! test ns_serverpath-4.1 {custom serverroot} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /serverpath ! } -result {200 testserverroot/arg} ! ! test ns_serverpath-4.2 {custom serverroot} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /serverpath?host=example.com ! } -result {200 testserverroot/example.com/arg} ! ! test ns_serverpath-4.3 {custom serverroot} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /serverpath?path=x ! } -result {200 testserverroot/arg/x} ! ! test ns_serverpath-4.4 {custom serverroot} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /serverpath?host=example.com&path=x ! } -result {200 testserverroot/example.com/arg/x} ! ! ! ! ! test ns_serverpath-5.1 {bad host} -body { ns_serverpath -host " " } -result ${serverroot} ! test ns_serverpath-5.2 {bad host} -body { ns_serverpath -host / } -result ${serverroot} ! test ns_serverpath-5.3 {bad host} -body { ns_serverpath -host ../example.com } -result ${serverroot} ! test ns_serverpath-5.4 {bad host} -body { ns_serverpath -host www.example.com//naughty } -result ${serverroot} ! test ns_serverpath-5.5 {bad host} -body { ns_serverpath -host www.example.com/../naughty } -result ${serverroot} ! test ns_serverpath-5.6 {bad host} -body { ns_serverpath -host .. 2dots } -result ${serverroot}/2dots ! test ns_serverpath-5.7 {bad host} -body { ns_serverpath -host ... 3dots } -result ${serverroot}/3dots Index: ns_pagepath.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_pagepath.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_pagepath.test 12 Apr 2005 06:21:24 -0000 1.1 --- ns_pagepath.test 27 Apr 2005 00:19:14 -0000 1.2 *************** *** 13,19 **** set serverroot [file join [ns_config "test" home] \ ! [ns_config "ns/server/test/fastpath" serverdir] ] ! set pagedir [ns_config "ns/server/test/fastpath" pagedir] ! set vhosts [ns_config "ns/server/test/vhost" hostprefix] --- 13,19 ---- set serverroot [file join [ns_config "test" home] \ ! [ns_config "ns/server/testvhost/fastpath" serverdir] ] ! set pagedir [ns_config "ns/server/testvhost/fastpath" pagedir] ! set vhosts [ns_config "ns/server/testvhost/vhost" hostprefix] *************** *** 34,51 **** test ns_pagepath-2.1 {host path} -body { ! ns_pagepath -host www.example.com ! } -result ${serverroot}/${vhosts}/e/x/a/example.com/${pagedir} test ns_pagepath-2.2 {host path} -body { ! ns_pagepath -host www.example.com -- ! } -result ${serverroot}/${vhosts}/e/x/a/example.com/${pagedir} - test ns_pagepath-2.3 {host path} -body { - ns_pagepath -host www.example.com -- x - } -result ${serverroot}/${vhosts}/e/x/a/example.com/${pagedir}/x ! test ns_pagepath-2.4 {host path} -body { ! ns_pagepath -host www.example.com x y ! } -result ${serverroot}/${vhosts}/e/x/a/example.com/${pagedir}/x/y --- 34,71 ---- test ns_pagepath-2.1 {host path} -body { ! ns_pagepath -host example.com ! } -result ${serverroot}/${pagedir} test ns_pagepath-2.2 {host path} -body { ! ns_pagepath -host example.com -- x y ! } -result ${serverroot}/${pagedir}/x/y ! ! test ns_pagepath-3.1 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /pagepath ! } -result [list 200 ${serverroot}/${vhosts}/t/e/s/testvhost/${pagedir}] ! ! test ns_pagepath-3.2 {virtual host path} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /pagepath?path=x ! } -result [list 200 ${serverroot}/${vhosts}/t/e/s/testvhost/${pagedir}/x] ! ! ! ! test ns_pagepath-4.1 {custom serverroot} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /pagepath ! } -result [list 200 testserverroot/arg/${pagedir}] ! ! test ns_pagepath-4.2 {custom serverroot} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /pagepath?host=example.com ! } -result [list 200 testserverroot/example.com/arg/${pagedir}] ! ! test ns_pagepath-4.3 {custom serverroot} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /pagepath?path=x ! } -result [list 200 testserverroot/arg/${pagedir}/x] ! ! test ns_pagepath-4.4 {custom serverroot} -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /pagepath?host=example.com&path=x ! } -result [list 200 testserverroot/example.com/arg/${pagedir}/x] Index: ns_conn_host.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_conn_host.test,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ns_conn_host.test 18 Apr 2005 12:57:15 -0000 1.2 --- ns_conn_host.test 27 Apr 2005 00:19:14 -0000 1.3 *************** *** 16,34 **** ! set driverlocation http://[ns_config "ns/server/test/module/nssock" hostname] ! set self ${driverlocation}:[ns_config "ns/server/test/module/nssock" port] ! ! ! ! test ns_conn_location-1.1 {http 1.1 host} -constraints serverListen -setup { ns_register_proc GET /location {ns_return 200 text/plain [ns_conn location] ;#} } -body { ! nstest_http -getbody 1 GET $self/location } -cleanup { ns_unregister_proc GET /location ! } -result [list 200 $self] - unset -nocomplain driverlocation self cleanupTests --- 16,42 ---- ! test ns_conn_location-1.1 {default location} -constraints serverListen -setup { ns_register_proc GET /location {ns_return 200 text/plain [ns_conn location] ;#} } -body { ! nstest_http -getbody 1 -- GET /location } -cleanup { ns_unregister_proc GET /location ! } -result {200 http://test} ! ! ! ! test ns_conn_location-2.1 {virtual host location} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost} -- GET /location ! } -result {200 http://testvhost} ! ! # 2.2: Test bad host headers..? ! ! ! ! test ns_conn_location-3.1 {custom location} -constraints serverListen -body { ! nstest_http -getbody 1 -setheaders {Host testvhost2} -- GET /location ! } -result {200 testlocation.arg} cleanupTests |