From: Stephen D. <sd...@us...> - 2005-04-18 13:04:24
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31413/tests Added Files: tclresp.test Log Message: Remove support for connid parameter to tcl response commands. (RFE #1156107) --- NEW FILE: tclresp.test --- # # $Header: /cvsroot/naviserver/naviserver/tests/tclresp.test,v 1.1 2005/04/18 13:04:14 sdeasey Exp $ # package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv if {[ns_config test listenport]} { testConstraint serverListen true } set driverlocation http://[ns_config "ns/server/test/module/nssock" hostname] set self ${driverlocation}:[ns_config "ns/server/test/module/nssock" port] test tclresp-1.1.1 {basic syntax} -body { ns_headers } -returnCodes error -result {wrong # args: should be "ns_headers status ?type? ?len?"} test tclresp-1.1.2 {basic syntax} -body { ns_headers 200 } -returnCodes error -result {no connection} test tclresp-1.2.1 {basic syntax} -body { ns_return } -returnCodes error -result {wrong # args: should be "ns_return status type string"} test tclresp-1.2.2 {basic syntax} -body { ns_return 200 text/plain x } -returnCodes error -result {no connection} test tclresp-1.3.1 {basic syntax} -body { ns_respond -x } -returnCodes error -result {wrong # args: should be "ns_respond ?-status status? ?-type type? ?-length length? ?-headers headers? ?-string string? ?-file file? ?-fileid fileid?"} test tclresp-1.3.2 {basic syntax} -body { ns_respond -string x } -returnCodes error -result {no connection} test tclresp-1.3.3 {basic syntax} -body { ns_respond -string x -file y } -returnCodes error -result {must specify only one of -string, -file or -fileid} test tclresp-1.3.4 {basic syntax} -body { ns_respond -fileid x } -returnCodes error -result {length required when -fileid is used} test tclresp-1.3.5 {basic syntax} -body { ns_respond -headers h -string x } -returnCodes error -result {illegal ns_set id: "h"} test tclresp-1.4.1 {basic syntax} -body { ns_returnfile } -returnCodes error -result {wrong # args: should be "ns_returnfile status type filename"} test tclresp-1.4.2 {basic syntax} -body { ns_returnfile 200 text/plain x } -returnCodes error -result {no connection} test tclresp-1.5.1 {basic syntax} -body { ns_returnfp } -returnCodes error -result {wrong # args: should be "ns_returnfp status type channel len"} test tclresp-1.5.2 {basic syntax} -body { ns_returnfp 200 text/plain x 0 } -returnCodes error -result {no connection} test tclresp-1.6.1 {basic syntax} -body { ns_returnbadrequest } -returnCodes error -result {wrong # args: should be "ns_returnbadrequest reason"} test tclresp-1.6.2 {basic syntax} -body { ns_returnbadrequest x } -returnCodes error -result {no connection} test tclresp-1.7.1 {basic syntax} -body { ns_returnnotfound } -returnCodes error -result {no connection} test tclresp-1.8.1 {basic syntax} -body { ns_returnunauthorized } -returnCodes error -result {no connection} test tclresp-1.9.1 {basic syntax} -body { ns_returnforbidden } -returnCodes error -result {no connection} test tclresp-1.10.1 {basic syntax} -body { ns_returnerror } -returnCodes error -result {wrong # args: should be "ns_returnerror status message"} test tclresp-1.10.2 {basic syntax} -body { ns_returnerror 200 x } -returnCodes error -result {no connection} test tclresp-1.11.1 {basic syntax} -body { ns_returnnotice } -returnCodes error -result {wrong # args: should be "ns_returnnotice status title message"} test tclresp-1.11.2 {basic syntax} -body { ns_returnnotice 200 x y } -returnCodes error -result {no connection} test tclresp-1.12.1 {basic syntax} -body { ns_returnredirect } -returnCodes error -result {wrong # args: should be "ns_returnredirect location"} test tclresp-1.12.2 {basic syntax} -body { ns_returnredirect http://example.com/ } -returnCodes error -result {no connection} test tclresp-1.13.1 {basic syntax} -body { ns_write } -returnCodes error -result {wrong # args: should be "ns_write string"} test tclresp-1.13.2 {basic syntax} -body { ns_write x } -returnCodes error -result {no connection} test tclresp-1.14.1 {basic syntax} -body { ns_connsendfp } -returnCodes error -result {wrong # args: should be "ns_connsendfp channel len"} test tclresp-1.14.2 {basic syntax} -body { ns_connsendfp x 0 } -returnCodes error -result {no connection} test tclresp-2.1 {ns_headers} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_headers 200 ;#} } -body { nstest_http -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 {} {}} test tclresp-2.2 {ns_headers} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_headers 200 text/plain ;#} } -body { nstest_http -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain {}} test tclresp-2.3 {ns_headers} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_headers 200 text/plain 99 ;#} } -body { nstest_http -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain 99} test tclresp-3.1 {ns_return} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_return 200 text/plain x ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain 1 x} test tclresp-4.1 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -string x ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 */* 1 x} test tclresp-4.2 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -type text/plain -string x ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain 1 x} test tclresp-4.3 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -status 99 -string x ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {99 */* 1 x} test tclresp-4.4 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -length 2 -string xxx ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 */* 2 xx} test tclresp-4.5 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp { set hdrs [ns_set create] ns_set put $hdrs k v ns_respond -headers $hdrs -string x #} } -body { nstest_http -getbody 1 -getheaders k GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 v x} test tclresp-4.6 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -file [ns_pagepath 10bytes] ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 */* 10 0123456789} test tclresp-4.7 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -file noexist ;#} } -body { nstest_http GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result 404 test tclresp-4.8 {ns_respond} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_respond -length 5 -fileid [open [ns_pagepath 10bytes]] ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 */* 5 01234} test tclresp-5.1 {ns_returnfile} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnfile 200 text/plain [ns_pagepath 10bytes] ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain 10 0123456789} test tclresp-5.2 {ns_returnfile} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnfile 200 text/plain noexist ;#} } -body { nstest_http GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result 404 test tclresp-6.1 {ns_returnfp} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnfp 200 text/plain [open [ns_pagepath 10bytes]] 5 ;#} } -body { nstest_http -getbody 1 -getheaders {content-type content-length} GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 text/plain 5 01234} test tclresp-7.1 {ns_returnbadrequest} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnbadrequest oops ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {400 *oops*} test tclresp-8.1 {ns_returnnotfound} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnnotfound ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {404 *Not Found*} test tclresp-8.2 {ns_returnunauthorized} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnunauthorized ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {401 *Access Denied*} test tclresp-8.3 {ns_returnforbidden} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnforbidden ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {403 *Forbidden*} test tclresp-9.1 {ns_returnerror} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnerror 99 oops ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {99 *oops*} test tclresp-10.1 {ns_returnnotice} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnnotice 200 TITLE MESSAGE ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {200 *TITLE*MESSAGE*} test tclresp-11.1 {ns_returnredirect} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_returnredirect http://example.com/x ;#} } -body { nstest_http -getbody 1 -getheaders location GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -match glob -result {302 http://example.com/x *Redirection*http://example.com/x*} test tclresp-12.1 {ns_write} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_headers 200; ns_write x ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result {200 x} test tclresp-13.1 {ns_connsendfp} -constraints serverListen -setup { ns_register_proc GET /tclresp {ns_connsendfp [open [ns_pagepath 10bytes]] 5 ;#} } -body { nstest_http -getbody 1 GET $self/tclresp } -cleanup { ns_unregister_proc GET /tclresp } -result 01234 unset -nocomplain driverlocation self cleanupTests |