# :nodoc: all require "test/unit" require "nitro/logger"; $log = Logger.new(STDERR) unless $log require "nitro/server/cookie" require "nitro/server/request" include N class TC_Request < Test::Unit::TestCase # :nodoc: all def setup end def teardown end =begin def test_parse request = N::Request.new request.parse_cookies("nsid=293230807; nauth=gmosx:meMXs0ifW7JBQ; koko=123&345") # empty cookie should be converted to nil. assert_nil(request.get_cookie("nonexisting-cookie")) assert_equal("293230807", request.get_cookie("nsid")) assert_equal("gmosx:meMXs0ifW7JBQ", request.get_cookie("nauth")) # multivalued cookie assert_equal(2, request.get_cookie("koko").length) assert_equal("123", request.get_cookie("koko")[0]) assert_equal("345", request.get_cookie("koko")[1]) end =end def test_get_cookie # bug: call get_cookie w/o cookies. request = N::Request.new request.in_cookies = nil assert_nothing_raised { request.get_cookie("test") } end def test_tx request = N::Request.new request.session = {} request.parameters = {} request.new_tx_entity!(1) assert_equal(1, request.session["TXSEQ"]) request.new_tx_entity!("test") assert_equal(2, request.session["TXSEQ"]) assert_equal("TX2", request["txid"]) assert_equal("test", request.get_tx_entity()) request.update_tx_entity!("changed") assert_equal("changed", request.get_tx_entity()) assert_equal(2, request.session["TXSEQ"]) request.del_tx_entity!; assert_equal(nil, request.get_tx_entity()) end end