File: test_ssl_server.rb

package info (click to toggle)
libwww-mechanize-ruby 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 956 kB
  • ctags: 883
  • sloc: ruby: 6,621; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 600 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "helper"

class SSLServerTest < Test::Unit::TestCase
  def setup
    @agent = Mechanize.new
  end

  def test_ssl_request
    non_ssl_page = @agent.get("http://localhost/form_test.html")
    ssl_page = @agent.get("https://localhost/form_test.html")
    assert_equal(non_ssl_page.body.length, ssl_page.body.length)
  end

  def test_ssl_request_verify
    non_ssl_page = @agent.get("http://localhost/form_test.html")
    @agent.ca_file = 'data/server.crt'
    ssl_page = @agent.get("https://localhost/form_test.html")
    assert_equal(non_ssl_page.body.length, ssl_page.body.length)
  end
end