Skip to content

Commit

Permalink
Add tests for realm case sensitivity in AuthChallenge
Browse files Browse the repository at this point in the history
As per RFC 1945 (section 11) and RFC 2617, the realm value is case sensitive.
This commit adds tests for realm case sensitivity in
Mechanize::HTTP::AuthChallenge.
  • Loading branch information
chris-reeves committed Jan 6, 2016
1 parent 98e0024 commit 65a4dd3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test_mechanize_http_auth_challenge.rb
Expand Up @@ -25,6 +25,14 @@ def test_realm_digest
assert_equal expected, @challenge.realm(@uri + '/foo')
end

def test_realm_digest_case
challenge = @AC.new 'Digest', { 'realm' => 'R' }, 'Digest realm=R'

expected = @AR.new 'Digest', @uri, 'R'

assert_equal expected, challenge.realm(@uri + '/foo')
end

def test_realm_unknown
@challenge.scheme = 'Unknown'

Expand All @@ -39,6 +47,12 @@ def test_realm_name
assert_equal 'r', @challenge.realm_name
end

def test_realm_name_case
challenge = @AC.new 'Digest', { 'realm' => 'R' }, 'Digest realm=R'

assert_equal 'R', challenge.realm_name
end

def test_realm_name_ntlm
challenge = @AC.new 'Negotiate, NTLM'

Expand Down

0 comments on commit 65a4dd3

Please sign in to comment.