module TestServerModule
Public Instance Methods
get_path(path)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 87 def get_path(path) return get_uri("http://127.0.0.1:9190/test/#{path}") end
get_uri(uri)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 76 def get_uri(uri) hash = { 'Cookie' => "userpass=user@e.com,95988593; path=/;", } str = '' open(uri, hash) {|f| str = f.read } return str end
ok_in(e, path, str)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 95 def ok_in(e, path, str) ok_eq(e, HTree(str).to_wabisabi.get_path(path).inside.get_single) end
ok_xp(e, path, str)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 91 def ok_xp(e, path, str) ok_eq(e, HTree(str).to_wabisabi.get_path(path)) end
read_page(pagekey)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 70 def read_page(pagekey) file = @dir+"#{pagekey}.txt" str = file.read return str end
session(config, memory, wreq, wres)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 45 def session(config, memory, wreq, wres) req = Qwik::Request.new(config) req.parse_webrick(wreq) res = Qwik::Response.new(config) res.set_webrick(wres) action = Qwik::Action.new action.init(config, memory, req, res) action.run res.setback(wres) return wres end
setup_server(bind_address = '127.0.0.1')
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 25 def setup_server(bind_address = '127.0.0.1') config = Qwik::Config.new config.update Qwik::Config::DebugConfig config.update Qwik::Config::TestConfig config[:bind_address] = bind_address server = Qwik::Server.new(config) memory = server.memory wreq = Qwik::WEBrickRequest.new(server.config) wreq.request_uri = URI.parse('http://example.com/test/') wreq.peeraddr = [nil, nil, nil, '127.0.0.1'] wres = Qwik::WEBrickResponse.new(server.config) wres.set_config return server, config, memory, wreq, wres end
teardown_server(server)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 61 def teardown_server(server) server.shutdown end
write_page(pagekey, content)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-server.rb, line 65 def write_page(pagekey, content) file = @dir+"#{pagekey}.txt" file.put(content+"\n") end