Sha256: 1c3dc2834c30c61cff9eebc32cb7c1591f6e317c933f59528fa5b5cbd3f6d560
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'rubygems' require 'mechanize' require 'test_includes' class BasicAuthTest < Test::Unit::TestCase include TestMethods def setup @agent = WWW::Mechanize.new { |a| a.log = Logger.new(nil) } end def test_auth_success @agent.basic_auth('mech', 'password') page = @agent.get("http://localhost:#{PORT}/htpasswd_auth") assert_equal('You are authenticated', page.body) end def test_auth_failure begin page = @agent.get("http://localhost:#{PORT}/htpasswd_auth") rescue WWW::Mechanize::ResponseCodeError => e assert_equal("401", e.response_code) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mechanize-0.5.1 | test/tc_authenticate.rb |
mechanize-0.5.0 | test/tc_authenticate.rb |
mechanize-0.5.2 | test/tc_authenticate.rb |