Sha256: 473960cfc7e4a8f0dfb6a02ea51a2ceaa5bcbd28f8d4f5717d54b168447d8bb3

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# :nodoc: all

require "test/unit"

require "glue/logger"

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.8.0 test/nitro/server/tc_request.rb